Defining typed errors with Data.TaggedError
Use Data.TaggedError to define your own typed error types. Tagged errors carry a _tag for pattern matching and can hold structured data (e.g. userId, message).
Unlike plain strings or Error, tagged errors are explicit in the type system and work with catchTag.
- Use
class X extends Data.TaggedError("TagName")<{ fields }> {} - The
_tagenablescatchTag("TagName", ...) - Add fields (e.g.
message,code) for context
Loading code editor...