Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class InvalidSettings(Exception):
- status_code = 400
- def __init__(self, message, status_code=None, payload=None):
- super(InvalidSettings, self).__init__()
- self.message = message
- if status_code is not None:
- self.status_code = status_code
- self.payload = payload
- def to_dict(self):
- rv = dict(self.payload or ())
- rv['message'] = self.message
- return rv
- @app.errorhandler(InvalidSettings)
- def handle_invalid_settings(error):
- response = json.dumps(error.to_dict())
- response.status_code = error.status_code
- return response
- TypeError: __init__() got an unexpected keyword argument 'errors'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement