-
Notifications
You must be signed in to change notification settings - Fork 66
Render correct error and enable buttons when pull failed #2964
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -868,14 +868,19 @@ const pollPullBackupThunk = createTypedAsyncThunk( | |
| ); | ||
| } | ||
| } catch ( error ) { | ||
| if ( signal.aborted ) { | ||
| const currentState = syncOperationsSelectors.selectPullState( | ||
| selectedSiteId, | ||
| remoteSiteId | ||
| )( getState() ); | ||
|
|
||
| if ( signal.aborted && currentState?.status.key === 'cancelled' ) { | ||
| return; | ||
| } | ||
|
|
||
| Sentry.captureException( error ); | ||
| return rejectWithValue( { | ||
| title: sprintf( __( 'Error pulling from %s' ), currentPullState.selectedSite.name ), | ||
| message: __( 'Failed to check backup file size. Please try again.' ), | ||
| message: error instanceof Error ? error.message : String( error ), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you we could use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Kat, I took a look at that function, and I see it checks for
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, let's leave as is then 👍 Thanks for the explanation! |
||
| } ); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we also need to check the pull state status here? In which scenario might the signal be aborted, but the pull state would have a different status?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I don't remember exactly 😅 I looked at my testing steps to recall, and it's the "Downloading backup" step, but, AFAIR, when I was debugging - it was caught here as "importing".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid muting errors and print them to users. Before, we just said "Import failed," which didn't help users to investigate the actual issue and try to fix it themselves.
Additionally, this PR fixed a misleading error in other cases - we always printed an irrelevant error "Failed to check backup file size. Please try again."