Closed Talkless closed 1 month ago
Maybe here, instead of creating an error handling by scratch, uses the Flask Error Handling: https://flask.palletsprojects.com/en/2.2.x/errorhandling/#error-handlers
I will check out how to use that, ;).
Great, thanks @nycholas !
Any unexpected error is translated to
ServerError
with default error code: https://github.com/cenobites/flask-jsonrpc/blob/a72a0c4ecaf4adce8086ea277161c35482e7ddcc/src/flask_jsonrpc/site.py#L146It would be useful to convert, for example, JWTError (https://github.com/mattupstate/flask-jwt/blob/c27084114e258863b82753fc574a362cd6c62fcd/flask_jwt/__init__.py#L160) to ServerError with specific error code for easier and more deterministic (avoiding string comparison) error handling in frontend.
Changing
into something similar to:
could maybe work, if we then could specify custom handler for unexpected errors.