本文整理汇总了Python中lib.Functions.Exit.printExceptionbase方法的典型用法代码示例。如果您正苦于以下问题:Python Exit.printExceptionbase方法的具体用法?Python Exit.printExceptionbase怎么用?Python Exit.printExceptionbase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.Functions.Exit
的用法示例。
在下文中一共展示了Exit.printExceptionbase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from lib.Functions import Exit [as 别名]
# 或者: from lib.Functions.Exit import printExceptionbase [as 别名]
def main():
dryRun = "-D" in sys_argv
debug = "-d" in sys_argv
verbose = "-v" in sys_argv
quiet = "-q" in sys_argv
# configure Exit class
Exit.quiet = quiet
try:
Init.init()
# handover to a class instance
poc = PoC(debug, verbose, quiet, dryRun)
poc.Run()
Exit.exit()
except (CommonException, ConfigurationException, SimulatorException, CompilerException) as ex:
print("{RED}ERROR:{NOCOLOR} {message}".format(message=ex.message, **Init.Foreground))
cause = ex.__cause__
if isinstance(cause, FileNotFoundError):
print("{YELLOW} FileNotFound:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, NotADirectoryError):
print("{YELLOW} NotADirectory:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, DuplicateOptionError):
print("{YELLOW} DuplicateOptionError:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, ConfigParser_Error):
print("{YELLOW} configparser.Error:{NOCOLOR} '{cause}'".format(cause=str(cause), **Init.Foreground))
elif isinstance(cause, ParserException):
print("{YELLOW} ParserException:{NOCOLOR} {cause}".format(cause=str(cause), **Init.Foreground))
cause = cause.__cause__
if (cause is not None):
print("{YELLOW} {name}:{NOCOLOR} {cause}".format(name=cause.__class__.__name__, cause= str(cause), **Init.Foreground))
elif isinstance(cause, ToolChainException):
print("{YELLOW} {name}:{NOCOLOR} {cause}".format(name=cause.__class__.__name__, cause=str(cause), **Init.Foreground))
cause = cause.__cause__
if (cause is not None):
if isinstance(cause, OSError):
print("{YELLOW} {name}:{NOCOLOR} {cause}".format(name=cause.__class__.__name__, cause=str(cause), **Init.Foreground))
else:
print(" Possible causes:")
print(" - The compile order is broken.")
print(" - A source file was not compiled and an old file got used.")
if (not (verbose or debug)):
print()
print("{CYAN} Use '-v' for verbose or '-d' for debug to print out extended messages.{NOCOLOR}".format(**Init.Foreground))
Exit.exit(1)
except EnvironmentException as ex: Exit.printEnvironmentException(ex)
except NotConfiguredException as ex: Exit.printNotConfiguredException(ex)
except PlatformNotSupportedException as ex: Exit.printPlatformNotSupportedException(ex)
except ExceptionBase as ex: Exit.printExceptionbase(ex)
except NotImplementedError as ex: Exit.printNotImplementedError(ex)
except Exception as ex: Exit.printException(ex)