Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include codec name in reports #38

Open
osdiab opened this issue Jul 15, 2020 · 5 comments
Open

Include codec name in reports #38

osdiab opened this issue Jul 15, 2020 · 5 comments

Comments

@osdiab
Copy link
Contributor

osdiab commented Jul 15, 2020

with long codec errors (mitigated by #32 ) it's often hard to tell which codec exactly was erroring - would be nice if a codec name was in the message, if present

@osdiab
Copy link
Contributor Author

osdiab commented Jul 15, 2020

whoops already does this but i just confused myself, closing

@osdiab osdiab closed this as completed Jul 15, 2020
@osdiab
Copy link
Contributor Author

osdiab commented Jul 15, 2020

nevermind i do think this doesn't get logged, reopening

@osdiab
Copy link
Contributor Author

osdiab commented Jul 15, 2020

hmmm problem with this is that io-ts-reporter currently uses error.context.type.name to get the expected type - if you provide a name for a codec, then it actually will replace that expected type with the name of the codec you provided, effectively making this reporter much less useful. not sure if there's any way to get around that unfortunately :P gonna ask about the new io-ts decoders to see what the plans are around codec naming

@osdiab
Copy link
Contributor Author

osdiab commented Jul 20, 2020

I think we should wait on this until the new version of io-ts becomes stable and this library can be adapted or forked for the new style of decoders. The draw() function in the new decoders is pretty nice, but it still handles unions pretty verbosely.

sandbox with union output, you can imagine how more nested unions would make this blow up: https://codesandbox.io/s/loving-saha-crub0?file=/src/index.ts

@gillchristian
Copy link
Owner

That's a good point. Let's wait for that. I think for now what we have is good enough.

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

No branches or pull requests

2 participants