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
Some time ago we added automatically a meta.code when there were validation errors on the model, using the symbol of the error (with ActiveModel > 5).
We ran into cases where it did not feel right to add validation errors, but it was more relevant to raise an error in the service and rescue the error in the json:api controller via register_exception. But adding the meta there does not work
# Does not work :
register_exception FooError, status: 409, code: :already_performed_the_action_in_last_24h
register_exception FooError, status: 409, meta: { code: :already_performed_the_action_in_last_24h }
It would be great if the register_exception class method allowed passing a meta or code value that would be merged in the exception meta (rather than having to write a custom Custom Exception Handler)
The text was updated successfully, but these errors were encountered:
Some time ago we added automatically a
meta.code
when there were validation errors on the model, using the symbol of the error (with ActiveModel > 5).We ran into cases where it did not feel right to add validation errors, but it was more relevant to raise an error in the service and rescue the error in the json:api controller via
register_exception
. But adding the meta there does not workIt would be great if the register_exception class method allowed passing a
meta
orcode
value that would be merged in the exception meta (rather than having to write a custom Custom Exception Handler)The text was updated successfully, but these errors were encountered: