feat: produce helpful error messages on httpRequest codec errors#168
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.
@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.
ericcrosson-bitgo
left a comment
There was a problem hiding this comment.
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.