Skip to content

Commit 80fe474

Browse files
committed
Add Exception handling
1 parent 01913b5 commit 80fe474

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sql_feed_graphite/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ def main():
6767
**query
6868
)
6969
continue
70+
71+
def excepthook(type, value, tb):
72+
# you can log the exception to a file here
73+
print ('ERROR:',type,value)
74+
75+
# the following line does the default (prints it to err)
76+
sys.__excepthook__(type, value, tb)
77+
78+
sys.excepthook = excepthook
7079

7180
if __name__ == '__main__':
7281
main()

0 commit comments

Comments
 (0)