Closed ericproulx closed 1 month ago
@numbata if you want to take a look
Unfortunately, since Grape::Exceptions::ValidationErrors
generates an array
when formatted in JSON, we won't be able to add the properties at the root level. Also, adding them to each element of the array might be to much.
Sure, would be happy to take it for tomorrow, but it feels as if you are already deep into it.
Unfortunately, since Grape::Exceptions::ValidationErrors generates an array when formatted in JSON, we won't be able to add the properties at the root level. Also, adding them to each element of the array might be to much.
Agreed! And what if we could just skip the backtrace and the original exception filling if the message structure is not suitable for it? Something like #2480
Following #2471, I found that this case is raising an error.
Our README shows the same kind of example but without original_exception and backtrace.
Nonetheless, It works for XML and TXT because of the simple ternary condition while JSON is doing something different when
Grape::Exceptions::ValidationErrors
If we want to add
original_exception
andbacktrace
I think we'll need to enhance Grape::Exceptions::ValidationErrors with a new function to include its when dumping JSON.