Skip to content
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

No way to report an error in custom type parsing #114

Open
mikebveil opened this issue Sep 28, 2018 · 1 comment
Open

No way to report an error in custom type parsing #114

mikebveil opened this issue Sep 28, 2018 · 1 comment

Comments

@mikebveil
Copy link

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?

mikebveil added a commit to PreVeil/maru that referenced this issue Sep 28, 2018
@mikebveil
Copy link
Author

Above commit is to the v0.11 branch because our dependencies are frozen currently. But I would port it to master before applying to elixir-maru/maru.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant