We're constructing a custom Maru type (use Maru.Type), and in our parse/2 function we do certain validations that may fail. But there doesn't seem to be a way to report validation errors back to the HTTP client. Returning {:error, …} from parse/2 doesn't trigger any special behavior, so we currently raise a custom exception. Looking at runtime.ex, it looks like the exception is handled and rethrown without any of the original exception data. So that when our code tries to rescue from Maru.Exceptions.Validation, we don't have enough context to produce a specific client response.
Is there a solution to this I'm missing? If not, would you accept a patch to include "inner exception" data in Maru.Exceptions.Validation?
We're constructing a custom Maru type (
use Maru.Type
), and in ourparse/2
function we do certain validations that may fail. But there doesn't seem to be a way to report validation errors back to the HTTP client. Returning{:error, …}
fromparse/2
doesn't trigger any special behavior, so we currentlyraise
a custom exception. Looking at runtime.ex, it looks like the exception is handled and rethrown without any of the original exception data. So that when our code tries torescue from Maru.Exceptions.Validation
, we don't have enough context to produce a specific client response.Is there a solution to this I'm missing? If not, would you accept a patch to include "inner exception" data in
Maru.Exceptions.Validation
?