mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 15:56:10 +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
|
@ -50,7 +50,15 @@ export async function makeGmailOAuthRequest(sessionKey, callback) {
|
||||||
auth: noauth,
|
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({
|
const localRequest = new NylasAPIRequest({
|
||||||
api: NylasAPI,
|
api: NylasAPI,
|
||||||
options: {
|
options: {
|
||||||
|
|
|
@ -236,6 +236,12 @@ class AccountStore extends NylasStore {
|
||||||
const existing = this.accountForId(accountId)
|
const existing = this.accountForId(accountId)
|
||||||
if (!existing) return // user may have deleted
|
if (!existing) return // user may have deleted
|
||||||
existing.fromJSON(json)
|
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(() => {
|
})).finally(() => {
|
||||||
this._caches = {}
|
this._caches = {}
|
||||||
|
|
Loading…
Reference in a new issue