Skip to content

How to provide an alternative error message? #49

@Profpatsch

Description

@Profpatsch

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.

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