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

Identify when a 577 error is thrown, send a new developer friendly message #180

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

Christian-Holbrook
Copy link
Contributor

No description provided.

src/Errors.ts Outdated Show resolved Hide resolved
Copy link
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one suggestion, but then this looks good to go!

Co-authored-by: Bronley Plumb <[email protected]>
} catch (installError: any) {
switch (installError.results.response.statusCode) {
case 577:
throw new errors.DeviceFailedConnectionError();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass in the installError and set it as .cause on the new error

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our Error type is this:
interface Error { name: string; message: string; stack?: string; }

I just added the .cause to the new Error type so that it can be passed in.

Let me know if that is sufficient.

src/Errors.ts Outdated Show resolved Hide resolved
Copy link
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the comments are addressed, I'm good with this!

… error as the cause so developers can trace back to the root cause of the error
@TwitchBronBron TwitchBronBron merged commit eb544d7 into master Nov 26, 2024
6 checks passed
@TwitchBronBron TwitchBronBron deleted the issues-109_handle_error_577 branch November 26, 2024 17:39
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

Successfully merging this pull request may close these issues.

2 participants