-
Notifications
You must be signed in to change notification settings - Fork 315
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
Improve error handling by adding types for Octokit error #156
Comments
We could add an OctokitRequestError type to https://github.com/octokit/types.ts/tree/master/src, so you can import it from I don't think it's currently possible to set types for errors that can be thrown by a method (microsoft/TypeScript#13219), that'd be cool though |
yeah, that would be neat. But until then I think |
could you send a pull request to https://github.com/octokit/types.ts/? |
@gr2m Done! |
Hi there,
I'm trying to handle the errors from Octokit but I'm not able to find docs (or better: types) for the errors that can be thrown.
As an example, this is how I hoped I'd be able to get a typed error:
But I can't find anything like
OctokitError
in the types. I can add my own error type like:Is there a concrete contract for errors I can see somewhere to ensure above type is correct? I looked in the docs and they seem incorrect (or out of date):
See for example this error I got back from
octokit.search.commits
:Notice how there is a
message
in:e.errors[i].message
where the docs only mentionse.message
.The text was updated successfully, but these errors were encountered: