mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-10 04:02:17 +00:00
Stringify Exceptions when creating SubsonicAPIExceptions from them
This prevents a `TypeError` from being raised when the `SubsonicAPIException` is serialized to JSON in preparation for being returned to the client.
This commit is contained in:
parent
608bea1152
commit
396df4f1ca
@ -18,7 +18,7 @@ from .exceptions import GenericError, MissingParameter, NotFound, ServerError
|
||||
@api.errorhandler(ValueError)
|
||||
def value_error(e):
|
||||
rollback()
|
||||
return GenericError(e)
|
||||
return GenericError("{0.__class__.__name__}: {0}".format(e))
|
||||
|
||||
@api.errorhandler(BadRequestKeyError)
|
||||
def key_error(e):
|
||||
@ -33,7 +33,7 @@ def not_found(e):
|
||||
@api.errorhandler(500)
|
||||
def generic_error(e): # pragma: nocover
|
||||
rollback()
|
||||
return ServerError(e)
|
||||
return ServerError("{0.__class__.__name__}: {0}".format(e))
|
||||
|
||||
#@api.errorhandler(404)
|
||||
@api.route('/<path:invalid>', methods = [ 'GET', 'POST' ]) # blueprint 404 workaround
|
||||
|
Loading…
Reference in New Issue
Block a user