-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
23 lines (20 loc) · 1004 Bytes
/
utils.py
File metadata and controls
23 lines (20 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
class Utils(object):
def __init__(self):
super().__init__()
@staticmethod
def standard_error(error_data):
try:
exc_type, exc_obj, exc_tb = error_data
return \
'ERROR: ' + exc_type.__name__ + ': ' + str(exc_obj) + '\nFILE: ' + exc_tb.tb_frame.f_code.co_filename + \
'\nMETHOD: ' + exc_tb.tb_frame.f_code.co_name + \
'\nLINE: ' + str(exc_tb.tb_lineno) + \
'\n------------------------------------------------------------------------'
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
return \
'ERROR: ' + exc_type.__name__ + ': ' + str(exc_obj) + '\nFILE: ' + exc_tb.tb_frame.f_code.co_filename + \
'\nMETHOD: ' + exc_tb.tb_frame.f_code.co_name + \
'\nLINE: ' + str(exc_tb.tb_lineno) + \
'\n------------------------------------------------------------------------'