Skip to main content
added 7 characters in body
Source Link
GG_Python
  • 3.5k
  • 5
  • 37
  • 50

All, I'm trying to raise a custom error using Flask-Restful, following the docsthe docs. For testing purposes, I've defined and registered the errors dictionary exactly link in the docs: api = flask_restful.Api(app, errors=errors).

However, when I want to raise the custom error using (e.g.) abort(409) within the resource module, firebug reports:

{ "message": "Conflict", "status": 409 }

This seems like the standard 409 error, nothing custom; from the docs, I would expect the custom error message- "A user with that username already exists."

I think I'm missing something regarding the raising of the error itself. Should I use the dictionary key in any way? Reviewing the Flask-Restful source code didn't help, though I tried.

All, I'm trying to raise a custom error using Flask-Restful, following the docs. For testing purposes, I've defined and registered the errors dictionary exactly link in the docs: api = flask_restful.Api(app, errors=errors).

However, when I want to raise the custom error using (e.g.) abort(409) within the resource module, firebug reports:

{ "message": "Conflict", "status": 409 }

This seems like the standard 409 error, nothing custom; from the docs, I would expect the custom error message- "A user with that username already exists."

I think I'm missing something regarding the raising of the error itself. Should I use the dictionary key in any way? Reviewing the Flask-Restful source code didn't help, though I tried.

All, I'm trying to raise a custom error using Flask-Restful, following the docs. For testing purposes, I've defined and registered the errors dictionary exactly link in the docs: api = flask_restful.Api(app, errors=errors).

However, when I want to raise the custom error using (e.g.) abort(409) within the resource module, firebug reports:

{ "message": "Conflict", "status": 409 }

This seems like the standard 409 error, nothing custom; from the docs, I would expect the custom error message- "A user with that username already exists."

I think I'm missing something regarding the raising of the error itself. Should I use the dictionary key in any way? Reviewing the Flask-Restful source code didn't help, though I tried.

Source Link
GG_Python
  • 3.5k
  • 5
  • 37
  • 50

Raising A Custom Error with Flask-Restful

All, I'm trying to raise a custom error using Flask-Restful, following the docs. For testing purposes, I've defined and registered the errors dictionary exactly link in the docs: api = flask_restful.Api(app, errors=errors).

However, when I want to raise the custom error using (e.g.) abort(409) within the resource module, firebug reports:

{ "message": "Conflict", "status": 409 }

This seems like the standard 409 error, nothing custom; from the docs, I would expect the custom error message- "A user with that username already exists."

I think I'm missing something regarding the raising of the error itself. Should I use the dictionary key in any way? Reviewing the Flask-Restful source code didn't help, though I tried.