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": { "symbolBetweenZeroTwelve": {
"message": "Symbol must be 11 characters or fewer." "message": "Symbol must be 11 characters or fewer."
}, },
"syncFailed": {
"message": "Sync failed"
},
"syncInProgress": { "syncInProgress": {
"message": "Sync in progress" "message": "Sync in progress"
}, },

View File

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