Effect CommunityEC
Effect Community16mo ago
57 replies
Aldwin

Creating a Schema for Translating Data to Tagged, Yieldable Errors

Hi. I want to create a Schema that translates some arbitrary data to a tagged, nominal, yieldable error. For example, {foo: "bar"} should become something like new MyFooError({_tag: "MyFooError", foo: "bar"}).

- I don't think I can use S.TaggedError, because it expects the _tag to be on the encoded data. I want it to be attached while decoding.
- I don't think I can use S.Class, because it doesn't let me extend from YieldableError.
Was this page helpful?