mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 10:12:00 +08:00
fix(auth): fix unnecessarly loud api errors
Summary: Fixes T7520 Gets rid of the Gmail auth error too Test Plan: manual Reviewers: juan Reviewed By: juan Maniphest Tasks: T7520 Differential Revision: https://phab.nylas.com/D3688
This commit is contained in:
parent
7210c80c5a
commit
231c510f86
2 changed files with 15 additions and 1 deletions
|
@ -50,7 +50,15 @@ export async function makeGmailOAuthRequest(sessionKey, callback) {
|
|||
auth: noauth,
|
||||
},
|
||||
});
|
||||
const remoteJSON = await remoteRequest.run()
|
||||
let remoteJSON = {}
|
||||
try {
|
||||
remoteJSON = await remoteRequest.run()
|
||||
} catch (err) {
|
||||
if (err.statusCode === 404) {
|
||||
return
|
||||
}
|
||||
throw err
|
||||
}
|
||||
const localRequest = new NylasAPIRequest({
|
||||
api: NylasAPI,
|
||||
options: {
|
||||
|
|
|
@ -236,6 +236,12 @@ class AccountStore extends NylasStore {
|
|||
const existing = this.accountForId(accountId)
|
||||
if (!existing) return // user may have deleted
|
||||
existing.fromJSON(json)
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
// Dont't throw here. If this function gets run immediately at
|
||||
// boot it may try before local-sync is ready. This is okay as
|
||||
// we'll refresh the accounts later anyway. We'll also be
|
||||
// eventually deprecating this API to merge it with K2
|
||||
})
|
||||
})).finally(() => {
|
||||
this._caches = {}
|
||||
|
|
Loading…
Reference in a new issue