From 0110c6afed4b62e3afd7ef42d49c3fd016cb6af9 Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 1 Oct 2024 15:06:11 -0400 Subject: [PATCH] Remove duplicate error log for googleActions.list --- server/app.js | 24 +++++++----------------- server/googleActions.js | 2 -- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/server/app.js b/server/app.js index fef433d59..04b3c3486 100644 --- a/server/app.js +++ b/server/app.js @@ -379,22 +379,12 @@ app.get('/account', asyncHandler(async (req, res, next)=>{ let googleCount = []; if(req.account) { if(req.account.googleId) { - try { - auth = await GoogleActions.authCheck(req.account, res, false); - } catch (e) { - auth = undefined; - console.log('Google auth check failed!'); - console.log(e); - } - if(auth.credentials.access_token) { - try { - googleCount = await GoogleActions.listGoogleBrews(auth); - } catch (e) { - googleCount = undefined; - console.log('List Google files failed!'); - console.log(e); - } - } + auth = await GoogleActions.authCheck(req.account, res, false) + + googleCount = await GoogleActions.listGoogleBrews(auth) + .catch((err)=>{ + console.error(err); + }); } const query = { authors: req.account.username, googleId: { $exists: false } }; @@ -408,7 +398,7 @@ app.get('/account', asyncHandler(async (req, res, next)=>{ username : req.account.username, issued : req.account.issued, googleId : Boolean(req.account.googleId), - authCheck : Boolean(req.account.googleId && auth.credentials.access_token), + authCheck : Boolean(req.account.googleId && auth?.credentials.access_token), mongoCount : mongoCount, googleCount : googleCount?.length }; diff --git a/server/googleActions.js b/server/googleActions.js index 4cba4d8ca..953ae27fb 100644 --- a/server/googleActions.js +++ b/server/googleActions.js @@ -121,9 +121,7 @@ const GoogleActions = { }) .catch((err)=>{ console.log(`Error Listing Google Brews`); - console.error(err); throw (err); - //TODO: Should break out here, but continues on for some reason. }); fileList.push(...obj.data.files); NextPageToken = obj.data.nextPageToken;