Commit d542495d authored by Nicolas Chevillot's avatar Nicolas Chevillot

Moved try/exception in the main function

parent daacc1b9
...@@ -26,6 +26,7 @@ from __future__ import print_function ...@@ -26,6 +26,7 @@ from __future__ import print_function
from __future__ import absolute_import from __future__ import absolute_import
import argparse import argparse
import sys import sys
import logging
from .manifest_parser import ManifestParser from .manifest_parser import ManifestParser
from .module_pool import ModulePool from .module_pool import ModulePool
...@@ -50,11 +51,19 @@ def main(): ...@@ -50,11 +51,19 @@ def main():
# #
options = _get_options(sys, parser) options = _get_options(sys, parser)
# Create a ModulePool object, this will become our workspace try:
modules_pool = ModulePool(options) # Create a ModulePool object, this will become our workspace
modules_pool = ModulePool(options)
# Execute the appropriated action for the freshly created modules pool # Execute the appropriated action for the freshly created modules pool
_action_runner(modules_pool) _action_runner(modules_pool)
except Exception as e:
import traceback
logging.error(e)
if options.full_error:
logging.error("Trace:")
traceback.print_exc()
quit(2)
def _action_runner(modules_pool): def _action_runner(modules_pool):
...@@ -210,12 +219,4 @@ def _get_options(sys_aux, parser): ...@@ -210,12 +219,4 @@ def _get_options(sys_aux, parser):
if __name__ == "__main__": if __name__ == "__main__":
try: main()
main()
except Exception as e:
import traceback
logging.error(e)
if global_mod.options.full_error:
logging.error("Trace:")
traceback.print_exc()
quit(2)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment