Skip to content

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

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

bitgopatmcl
Copy link
Contributor

Attempts to produce a helpful error message when invalid codecs are passed to httpRequest.
It is a workaround inspired by this comment

Before:
image

After:
image

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

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.
@bitgopatmcl bitgopatmcl requested a review from a team July 19, 2022 15:43
params?: EmitOutputTypeErrors<P['params'], string | undefined, 'string | undefined'>;
query?: EmitOutputTypeErrors<
P['query'],
string | string[] | undefined,
Copy link
Contributor

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.

Copy link
Contributor

@ericcrosson-bitgo ericcrosson-bitgo left a 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?

@ericcrosson-bitgo ericcrosson-bitgo merged commit 4673303 into BitGo:beta Jul 19, 2022
@github-actions
Copy link

🎉 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 📦🚀

@github-actions
Copy link

🎉 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 📦🚀

@github-actions
Copy link

🎉 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 📦🚀

@github-actions
Copy link

🎉 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 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants