1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fixing error handling for publish() (MobileSync) (#11909)

This commit is contained in:
ryanml 2021-08-25 09:16:12 -07:00 committed by GitHub
parent dc3e74a66a
commit b021c35f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -2418,6 +2418,9 @@
"symbolBetweenZeroTwelve": {
"message": "Symbol must be 11 characters or fewer."
},
"syncFailed": {
"message": "Sync failed"
},
"syncInProgress": {
"message": "Sync in progress"
},

View File

@ -201,9 +201,9 @@ export default class MobileSyncPage extends Component {
sendByPost: false, // true to send via post
storeInHistory: false,
},
(status, response) => {
(status, _response) => {
if (status.error) {
reject(response);
reject(status.errorData);
} else {
resolve();
}
@ -225,6 +225,7 @@ export default class MobileSyncPage extends Component {
preferences,
transactions,
} = await this.props.fetchInfoToSync();
const { t } = this.context;
const allDataStr = JSON.stringify({
accounts,
@ -245,7 +246,7 @@ export default class MobileSyncPage extends Component {
await this.sendMessage(chunks[i], i + 1, totalChunks);
}
} catch (e) {
this.props.displayWarning('Sync failed :(');
this.props.displayWarning(`${t('syncFailed')} :(`);
this.setState({ syncing: false });
this.syncing = false;
this.notifyError(e.toString());
@ -266,9 +267,9 @@ export default class MobileSyncPage extends Component {
sendByPost: false, // true to send via post
storeInHistory: false,
},
(status, response) => {
(status, _response) => {
if (status.error) {
reject(response);
reject(status.errorData);
} else {
resolve();
}