class Error(Exception):
def __init__(self, code, message, context=None):
super().__init__(message)
self.code = code
self.message = message
self.context = context
#print(code, message, context)
def __str__(self):
if self.context:
return self.message + ': "' + self.context + '"'
elif self.message:
return self.message
else:
return self.code