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

fix(app-shell): forward usb request errors and log #15959

Merged

Conversation

sfoster1
Copy link
Member

@sfoster1 sfoster1 commented Aug 9, 2024

We were swallowing all errors from usb requests, which doesn't seem like a great idea - it definitely led to lots of errors in browser logs.

Fixing this by propagating the errors back across the IPC allows the browser-side tanstack query stuff to actually notice that there were errors. Previously, those queries would just come back with undefined, and stuff higher up the stack would see that its maintenance run data was undefined, which is not something we test for or care about.

This seems to be a magic bullet that fixes various USB stability issues; I'm a bit suspicious of it solving everything, but in my testing it solves some things and it certainly can't hurt.

Closes RQA-2931 RQA-2933

We were swallowing all errors from usb requests, which doesn't seem like
a great idea - it definitely led to lots of errors in browser logs.

While we're at it, let's get some more in-detph logging of usb requests.
@sfoster1 sfoster1 marked this pull request as ready for review August 20, 2024 19:54
@sfoster1 sfoster1 requested a review from a team as a code owner August 20, 2024 19:54
@sfoster1 sfoster1 requested review from jerader, shlokamin and mjhuff and removed request for a team August 20, 2024 19:54
Copy link
Contributor

@mjhuff mjhuff left a comment

Choose a reason for hiding this comment

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

Exciting!

@@ -94,6 +94,19 @@ function reconstructFormData(ipcSafeFormData: IPCSafeFormData): FormData {
return result
}

const cloneError = (e: any): Record<string, unknown> =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
Object.entries(axios.isAxiosError(e) ? e.toJSON() : e).reduce<
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, in practice, is this ever not an axios error? It's probably safer to do this regardless.

Copy link
Member Author

Choose a reason for hiding this comment

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

not as far as I know, but this way if we ever make a new bug it will at least get reported in the browser logs

return await remote.ipcRenderer.invoke('usb:request', configProxy)
const result = await remote.ipcRenderer.invoke('usb:request', configProxy)
if (result?.error != null) {
throw result.error
Copy link
Contributor

Choose a reason for hiding this comment

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

ah

@sfoster1 sfoster1 merged commit 649b9aa into chore_release-8.0.0 Aug 21, 2024
23 checks passed
@sfoster1 sfoster1 deleted the RQA-2931-usb-diagnosis-app-build-as-release branch August 21, 2024 13:31
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