Skip to content

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

@mikebveil

Description

@mikebveil

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions