Error handler added

This commit is contained in:
Lukas Klass 2020-04-08 09:45:20 +02:00
parent 90256d8ced
commit 7d1e0f3b2e
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
import logging
import sys
import traceback
def error(msg: str, exit_: bool = True):
"""
Handle errors
Parameters
----------
msg : str
Error message to show
exit_ : bool
Exit program
Returns
-------
"""
logging.error(msg)
if exit_:
traceback.print_stack()
sys.exit(1)