Skip to content

Expand decode error to include information about error #2

Closed
@hellos3b

Description

@hellos3b

Would be nice if the decode exception included information about the error instead of the error message, so the output could be formatted nicely to an end user

type path = array<string>
type expected = string
type actual = string

exception DecodeError(path, expected, actual)

The path property can point to where in an object or array that the error occured, so I can log a message like Expected "string" in Object.nested.field[0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions