Implement a custom global exception hook
This commit is contained in:
parent
bed16c2a8f
commit
60a262ef9c
1 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
from core.Constants import Constants
|
||||
from core.Errors import MissingSubscriptionError, InvalidSubscriptionError
|
||||
from core.Errors import MissingSubscriptionError, InvalidSubscriptionError, UnknownConnectionTypeError
|
||||
from core.controllers.ApplicationController import ApplicationController
|
||||
from core.controllers.ApplicationVersionController import ApplicationVersionController
|
||||
from core.controllers.ClientController import ClientController
|
||||
|
@ -25,6 +25,7 @@ from typing import Optional, Union
|
|||
import argparse
|
||||
import pprint
|
||||
import re
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
|
@ -80,6 +81,16 @@ if __name__ == '__main__':
|
|||
|
||||
return candidate
|
||||
|
||||
def __handle_exception(identifier, message, traceback):
|
||||
|
||||
if issubclass(identifier, UnknownConnectionTypeError):
|
||||
print('Please specify the desired connection method and try again.\n')
|
||||
|
||||
else:
|
||||
sys.__excepthook__(identifier, message, traceback)
|
||||
|
||||
sys.excepthook = __handle_exception
|
||||
|
||||
pristine_parser = argparse.ArgumentParser(add_help=False)
|
||||
pristine_parser.add_argument('--pristine', '-p', action='store_true')
|
||||
|
||||
|
|
Loading…
Reference in a new issue