Skip to content

Comments

Experimental: add getErrorForest#544

Open
PoldarnKJ wants to merge 1 commit intogcanti:masterfrom
PoldarnKJ:feat
Open

Experimental: add getErrorForest#544
PoldarnKJ wants to merge 1 commit intogcanti:masterfrom
PoldarnKJ:feat

Conversation

@PoldarnKJ
Copy link

Add getErrorForest for customize error report.

   const decoder = _.type({
        a: _.string
      })
      assert.deepStrictEqual(
        pipe(decoder.decode({ c: [1] }), E.mapLeft(_.getErrorForest)),
        E.left([
          {
            value: {
              _tag: 'Key',
              key: 'a',
              kind: 'required'
            },
            forest: [
              {
                value: {
                  _tag: 'Leaf',
                  error: 'string',
                  actual: undefined
                },
                forest: []
              }
            ]
          }
        ])
      )
    })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant