You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a dictionary application. On the backend side, there are certain validation rules for a dictionary entry. This is the error response when one of them is violated:
However, when the frontend client consumes this response, the error message is not user-friendly enough to display directly on the web page. Additionally, to support i18n, it must also provide the message in another language (e.g: Japanese).
It would be nice if I can provide 2 new attributes besides the default message:
detail: A human-readable, lengthier explanation of the error, suitable for direct display.
error: An unique identifier to the error in the response. It could be the class name of an exception. The client can also map this identifier to any custom messages instead of using the detail string above.
The response would look like this:
{
"_state": "ERR",
"_issues": {
"pronunciation": {
"error": "InvalidPronunciationError",
"message": "must be of ja_pronunciation type",
"detail": "Pronunciation must be standard Hiragana or Katanata characters"
}
},
"_error": {
"code": 422,
"message": "Insertion failure: 1 document(s) contain(s) error(s)"
}
}
Environment
Python version: 3.8.5
Eve version: 1.1.5
@nicolaiarocci Thank you for reading and please tell me what you think.
The text was updated successfully, but these errors were encountered:
I came here looking similar to the Mongo Schema Validation, where I could write in a field description the requirements of the field. Unfortunately looks like Cerberror is the closest solution to what I want. But this is too deep inside Eve to just "replace".
I am developing a dictionary application. On the backend side, there are certain validation rules for a dictionary entry. This is the error response when one of them is violated:
However, when the frontend client consumes this response, the error message is not user-friendly enough to display directly on the web page. Additionally, to support i18n, it must also provide the message in another language (e.g: Japanese).
It would be nice if I can provide 2 new attributes besides the default message:
detail
: A human-readable, lengthier explanation of the error, suitable for direct display.error
: An unique identifier to the error in the response. It could be the class name of an exception. The client can also map this identifier to any custom messages instead of using thedetail
string above.The response would look like this:
Environment
@nicolaiarocci Thank you for reading and please tell me what you think.
The text was updated successfully, but these errors were encountered: