mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-09 07:18:27 +01:00
main: print exception only in verbose mode
Fixes #230 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+6
-2
@@ -5,19 +5,23 @@ main entry point / argument parsing for dvc
|
||||
import sys
|
||||
from dvc.settings import Settings
|
||||
from dvc.logger import Logger
|
||||
from dvc.config import ConfigError
|
||||
|
||||
def main():
|
||||
try:
|
||||
settings = Settings(sys.argv[1:])
|
||||
instance = settings._parsed_args.func(settings)
|
||||
except Exception as e:
|
||||
Logger.error("Exception caught while parsing settings", exc_info=True)
|
||||
# In case we didn't even manage to parse options
|
||||
exc_info = '-v' in sys.argv or '--verbose' in sys.argv
|
||||
Logger.error("Settings error: {}".format(e), exc_info=exc_info)
|
||||
return 255
|
||||
|
||||
try:
|
||||
ret = instance.run()
|
||||
except Exception as e:
|
||||
Logger.error("Exception caught in " + instance.__class__.__name__, exc_info=True)
|
||||
exc_info = settings.parsed_args.verbose
|
||||
Logger.error("{} error: {}".format(instance.__class__.__name__, e), exc_info=exc_info)
|
||||
return 254
|
||||
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user