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
Hibernate generates very generic exceptions when you hit constraints i.e. unique column constraint. This result in very generic error response in Elide.
Desired Behavior
I want to be able to swap the nested ConstraintViolation with a proper business exception that returns proper error codes etc.
Current Behavior
Statuscode 423 Locked is returned with the generic text "could not execute statement".
Possible Solution
I can give Elide a Map<String, Function<ConstraintViolation, Throwable>> where the keys are the names of the constraint hit.
If a ConstraintViolation occurs, Elide will lookup the constraint name and if it finds one, will map the exception by calling the function from the map value.
I would implement this error mapping in the flush method of AbstractJpaTransaction. Not sure yet how to pass the map in there.
This would be a JpaDatastore only solution. Ideas for more general solutions are welcome.
Context
I'm trying to improve error handling for our frontend people.
The text was updated successfully, but these errors were encountered:
* Add ability to map unknown exceptions to custom exceptions
Closes#2204
* Add tests for ErrorMapper
* Fix typo
* Add ErrorMapper to ElideStandalone
By default the mapper does not map anything.
* Add ErrorMapper to GraphQL QueryRunner
Hibernate generates very generic exceptions when you hit constraints i.e. unique column constraint. This result in very generic error response in Elide.
Desired Behavior
I want to be able to swap the nested ConstraintViolation with a proper business exception that returns proper error codes etc.
Current Behavior
Statuscode 423 Locked is returned with the generic text "could not execute statement".
Possible Solution
I can give Elide a Map<String, Function<ConstraintViolation, Throwable>> where the keys are the names of the constraint hit.
If a ConstraintViolation occurs, Elide will lookup the constraint name and if it finds one, will map the exception by calling the function from the map value.
I would implement this error mapping in the
flush
method of AbstractJpaTransaction. Not sure yet how to pass the map in there.This would be a JpaDatastore only solution. Ideas for more general solutions are welcome.
Context
I'm trying to improve error handling for our frontend people.
The text was updated successfully, but these errors were encountered: