-
Notifications
You must be signed in to change notification settings - Fork 25
fix: handling error on route backend #241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix: handling error on route backend #241
Conversation
- Add decorator to handle Integrity Error or other error on process CRUD - Add decorator on delete route for organisms and users Reviewed-by: andriac
d321c48 to
290d671
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L'idée est bonne ! Toutefois, je pense que la déclaration du décorateurs sur les routes concernées n'est pas idéal. Je pense qu'il est plus simple de s'appuyer sur la mécanique Flask des error_handlers https://flask.palletsprojects.com/en/stable/errorhandling/.
L'idée serait d'appeller une fonction à chaque erreur 500. Dans cette fonction, si l'erreur est une erreur SQLA, on affiche le message d'erreur (dans un flash).
app/t_roles/route.py
Outdated
| 6, | ||
| ) | ||
| @fnauth.check_auth(6) | ||
| @handle_db_errors("user.users", "l'utilisateur", redirect_on_error=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lourd si on doit déclarer ça plusieurs fois ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai proposé une solution centralisée en terme de gestion d'erreurs
ab37e68 to
fc80d3e
Compare
- Add handler function according to current function existing in errors.py Reviewed-by: andriac
fc80d3e to
b36db95
Compare
Before when error happened
After with handle error
Reviewed-by: andriacap