main: fix UnicodeError misplacement

This commit is contained in:
Mr. Outis
2019-09-27 18:20:00 -05:00
parent 0bdad65f04
commit 39dc79b418
+8 -10
View File
@@ -54,16 +54,14 @@ def main(argv=None):
ret = 253
except DvcParserError:
ret = 254
except UnicodeError:
if not is_py2:
raise
logger.exception(
"unicode is not supported in DVC for Python 2"
" (end-of-life January 1, 2020), please upgrade to Python 3"
)
ret = 255
except Exception: # pylint: disable=broad-except
logger.exception("unexpected error")
except Exception as exc: # pylint: disable=broad-except
if isinstance(exc, UnicodeError) and is_py2:
logger.exception(
"unicode is not supported in DVC for Python 2 "
"(end-of-life January 1, 2020), please upgrade to Python 3"
)
else:
logger.exception("unexpected error")
ret = 255
finally:
logger.setLevel(outerLogLevel)