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

Feature: Better error messages #24

Open
Adzz opened this issue Jun 17, 2022 · 3 comments
Open

Feature: Better error messages #24

Adzz opened this issue Jun 17, 2022 · 3 comments

Comments

@Adzz
Copy link
Owner

Adzz commented Jun 17, 2022

When a cast function raises unexpectedly it can be tricky to see what field actually caused it. This can be helped by unit testing the cast fns (so you are sure they handle the cases you expect) and then possibly IO.inspecting the value as it comes in. But it would be nicer to be able to see which field caused the error just straight off the bat.

The obvious thing to do would be to wrap the cast__fns in a try catch but I don't like that at all...

@Adzz
Copy link
Owner Author

Adzz commented Jul 12, 2022

A small improvement in this area #28

@Adzz
Copy link
Owner Author

Adzz commented Sep 16, 2022

This applies to casting fns that are atoms and casting fns that are MFA tuples

@Adzz
Copy link
Owner Author

Adzz commented Sep 28, 2022

Improved in #40

We could keep evolving the error message that is returned, eg calling the trace we give a schema-trace

suggestion it could be something like:

CSchema: field(:c)
  BSchema: has_one(:b)
    ASchema: has_one(:a)

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