exceptions.py 283 Bytes RawBlameHistoryPermalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 from io import StringIO import traceback def exception_message(): with StringIO() as f: traceback.print_exc(file=f) return f.getvalue() class BaseError(Exception): def __init__(self, code, message): self.code = code self.message = message