mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-13 21:52:18 +00:00
Merge pull request #119 from pR0Ps/bugfix/type-error
Ensure that Exceptions are stringified before being returned
This commit is contained in:
commit
9ab6af1ae6
@ -18,7 +18,7 @@ from .exceptions import GenericError, MissingParameter, NotFound, ServerError
|
|||||||
@api.errorhandler(ValueError)
|
@api.errorhandler(ValueError)
|
||||||
def value_error(e):
|
def value_error(e):
|
||||||
rollback()
|
rollback()
|
||||||
return GenericError(e)
|
return GenericError("{0.__class__.__name__}: {0}".format(e))
|
||||||
|
|
||||||
@api.errorhandler(BadRequestKeyError)
|
@api.errorhandler(BadRequestKeyError)
|
||||||
def key_error(e):
|
def key_error(e):
|
||||||
@ -33,7 +33,7 @@ def not_found(e):
|
|||||||
@api.errorhandler(500)
|
@api.errorhandler(500)
|
||||||
def generic_error(e): # pragma: nocover
|
def generic_error(e): # pragma: nocover
|
||||||
rollback()
|
rollback()
|
||||||
return ServerError(e)
|
return ServerError("{0.__class__.__name__}: {0}".format(e))
|
||||||
|
|
||||||
#@api.errorhandler(404)
|
#@api.errorhandler(404)
|
||||||
@api.route('/<path:invalid>', methods = [ 'GET', 'POST' ]) # blueprint 404 workaround
|
@api.route('/<path:invalid>', methods = [ 'GET', 'POST' ]) # blueprint 404 workaround
|
||||||
|
Loading…
Reference in New Issue
Block a user