Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to provide an alternative error message? #49

Open
Profpatsch opened this issue Aug 2, 2021 · 0 comments
Open

How to provide an alternative error message? #49

Profpatsch opened this issue Aug 2, 2021 · 0 comments

Comments

@Profpatsch
Copy link

I have a row that requires two fields to be set.

Something akin to

  foo <- exactly "foo"
  bar <- exactly "bar"

If I give it "foo", it will return UnexpectedEndOfRow; however, I can make this error nicer, because I have some local information about what is missing.

There is a function

onError :: Decode e s a -> (DecodeErrors e -> Decode e s a) -> Decode e s a

but similar to the last issue (#47) it’s not at all clear to me how to go from e.g. decodeError :: DecodeError e -> DecodeValidation e a to a full Decode e s a, i.e how to fill that continuation of onError and provide an alternative error message.

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

No branches or pull requests

1 participant