-
Notifications
You must be signed in to change notification settings - Fork 22
feat: produce helpful error messages on httpRequest codec errors #168
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
Conversation
Attempts to produce a helpful error message when invalid codecs are passed to `httpRequest`. It is a workaround until something like microsoft/TypeScript#40468 is merged.
params?: EmitOutputTypeErrors<P['params'], string | undefined, 'string | undefined'>; | ||
query?: EmitOutputTypeErrors< | ||
P['query'], | ||
string | string[] | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bitgopatmcl is there already a type for ParamValue
, QueryValue
and HeaderValue
? I was wondering why params and headers were a single string
, before I realized it was actually the values' types. Using a type would make it more explicit, and hopefully the error output would remain readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement! I didn't know such a formatting was possible.
@louib-bitgo I'm not sure I follow, are you able to push a quick proof of concept to make sure we're on the same page?
🎉 This PR is included in version 0.2.0-beta.6 🎉 The release is available on npm package (@beta dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.0.0-beta.17 🎉 The release is available on npm package (@beta dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 0.2.0-beta.9 🎉 The release is available on npm package (@beta dist-tag) Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 0.2.0-beta.12 🎉 The release is available on npm package (@beta dist-tag) Your semantic-release bot 📦🚀 |
Attempts to produce a helpful error message when invalid codecs are passed to
httpRequest
.It is a workaround inspired by this comment
Before:

After:

In this case the "before" error isn't too bad, but this technique could be useful in other places.