Skip to content

Commit 1b1f58f

Browse files
committed
replace Py3 exception passing to logger with py2 version
1 parent b8ba072 commit 1b1f58f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

schema_salad/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import argparse
33
import logging
44
import sys
5+
import traceback
56
import pkg_resources # part of setuptools
67
from . import schema
78
from . import jsonld_context
@@ -103,7 +104,7 @@ def main(argsl=None): # type: (List[str]) -> int
103104
schema_raw_doc, schema_uri)
104105
except (validate.ValidationException) as e:
105106
_logger.error("Schema `%s` failed link checking:\n%s",
106-
args.schema, e, exc_info=(e if args.debug else False))
107+
args.schema, e, exc_info=(True if args.debug else False))
107108
_logger.debug("Index is %s", metaschema_loader.idx.keys())
108109
_logger.debug("Vocabulary is %s", metaschema_loader.vocab.keys())
109110
return 1
@@ -148,7 +149,8 @@ def main(argsl=None): # type: (List[str]) -> int
148149

149150
if isinstance(avsc_names, Exception):
150151
_logger.error("Schema `%s` error:\n%s", args.schema,
151-
avsc_names, exc_info=(avsc_names if args.debug else False))
152+
avsc_names, exc_info=((type(avsc_names), avsc_names,
153+
None) if args.debug else None))
152154
if args.print_avro:
153155
print(json.dumps(avsc_obj, indent=4))
154156
return 1

schema_salad/ref_resolver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def resolve_all(self, document, base_url, file_base=None, checklinks=True):
553553
document[key], _ = loader.resolve_all(
554554
val, base_url, file_base=file_base, checklinks=False)
555555
except validate.ValidationException as v:
556-
_logger.warn("loader is %s", id(loader), exc_info=v)
556+
_logger.warn("loader is %s", id(loader), exc_info=True)
557557
raise validate.ValidationException("(%s) (%s) Validation error in field %s:\n%s" % (
558558
id(loader), file_base, key, validate.indent(str(v))))
559559

@@ -577,7 +577,7 @@ def resolve_all(self, document, base_url, file_base=None, checklinks=True):
577577
val, base_url, file_base=file_base, checklinks=False)
578578
i += 1
579579
except validate.ValidationException as v:
580-
_logger.warn("failed", exc_info=v)
580+
_logger.warn("failed", exc_info=True)
581581
raise validate.ValidationException("(%s) (%s) Validation error in position %i:\n%s" % (
582582
id(loader), file_base, i, validate.indent(str(v))))
583583

0 commit comments

Comments
 (0)