0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-09 15:52:43 +00:00

Remove duplicate error log for googleActions.list

This commit is contained in:
Trevor Buckner
2024-10-01 15:06:11 -04:00
parent 0e29620710
commit 0110c6afed
2 changed files with 7 additions and 19 deletions

View File

@@ -379,22 +379,12 @@ app.get('/account', asyncHandler(async (req, res, next)=>{
let googleCount = []; let googleCount = [];
if(req.account) { if(req.account) {
if(req.account.googleId) { if(req.account.googleId) {
try { auth = await GoogleActions.authCheck(req.account, res, false)
auth = await GoogleActions.authCheck(req.account, res, false);
} catch (e) { googleCount = await GoogleActions.listGoogleBrews(auth)
auth = undefined; .catch((err)=>{
console.log('Google auth check failed!'); console.error(err);
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);
}
}
} }
const query = { authors: req.account.username, googleId: { $exists: false } }; 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, username : req.account.username,
issued : req.account.issued, issued : req.account.issued,
googleId : Boolean(req.account.googleId), 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, mongoCount : mongoCount,
googleCount : googleCount?.length googleCount : googleCount?.length
}; };

View File

@@ -121,9 +121,7 @@ const GoogleActions = {
}) })
.catch((err)=>{ .catch((err)=>{
console.log(`Error Listing Google Brews`); console.log(`Error Listing Google Brews`);
console.error(err);
throw (err); throw (err);
//TODO: Should break out here, but continues on for some reason.
}); });
fileList.push(...obj.data.files); fileList.push(...obj.data.files);
NextPageToken = obj.data.nextPageToken; NextPageToken = obj.data.nextPageToken;