Posted on:
Last modified:
For user defined exceptions, just subclass Exception
except Exception as e: # SystemExit, KeyboardInterrupt, GeneratorExit is not captured
log("Reason", e) # the baseline is to record
BaseException
+-- SystemExit
+-- *KeyboardInterrupt*
+-- GeneratorExit
+-- Exception
+-- *StopIteration*
+-- *StandardError*
| +-- BufferError
| +-- *ArithmeticError*
| | +-- FloatingPointError
| | +-- OverflowError
| | +-- ZeroDivisionError
| +-- AssertionError
| +-- AttributeError
| +-- EnvironmentError
| | +-- *IOError*
| | +-- OSError
| | +-- WindowsError (Windows)
| | +-- VMSError (VMS)
| +-- EOFError
| +-- *ImportError*
| +-- *LookupError*
| | +-- IndexError
| | +-- KeyError
| +-- MemoryError
| +-- *NameError*
| | +-- UnboundLocalError
| +-- ReferenceError
| +-- RuntimeError
| | +-- NotImplementedError
| +-- *SyntaxError*
| | +-- IndentationError
| | +-- TabError
| +-- SystemError
| +-- *TypeError*
| +-- *ValueError*
| +-- UnicodeError
| +-- UnicodeDecodeError
| +-- UnicodeEncodeError
| +-- UnicodeTranslateError
+-- *Warning*
+-- DeprecationWarning
+-- PendingDeprecationWarning
+-- RuntimeWarning
+-- SyntaxWarning
+-- UserWarning
+-- FutureWarning
+-- ImportWarning
+-- UnicodeWarning
+-- BytesWarning
© 2016-2022 Yifei Kong. Powered by ynotes
All contents are under the CC-BY-NC-SA license, if not otherwise specified.
Opinions expressed here are solely my own and do not express the views or opinions of my employer.
友情链接: MySQL 教程站