0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-10 02:42:43 +00:00

Throw errors in listGoogleBrews() and getGoogleFolder()

This commit is contained in:
Trevor Buckner
2021-08-20 01:45:50 -04:00
parent 5f388ed41f
commit 519d102a6e

View File

@@ -17,7 +17,7 @@ GoogleActions = {
if(!account || !account.googleId){ // If not signed into Google if(!account || !account.googleId){ // If not signed into Google
const err = new Error('Not Signed In'); const err = new Error('Not Signed In');
err.status = 401; err.status = 401;
throw err; throw (err);
} }
const oAuth2Client = new google.auth.OAuth2( const oAuth2Client = new google.auth.OAuth2(
@@ -60,6 +60,7 @@ GoogleActions = {
.catch((err)=>{ .catch((err)=>{
console.log('Error searching Google Drive Folders'); console.log('Error searching Google Drive Folders');
console.error(err); console.error(err);
throw (err);
}); });
let folderId; let folderId;
@@ -69,8 +70,9 @@ GoogleActions = {
resource : fileMetadata resource : fileMetadata
}) })
.catch((err)=>{ .catch((err)=>{
console.log('Error creating google app folder'); console.log('Error creating Google Drive folder');
console.error(err); console.error(err);
throw (err);
}); });
folderId = obj.data.id; folderId = obj.data.id;
@@ -99,7 +101,9 @@ GoogleActions = {
q : 'mimeType != \'application/vnd.google-apps.folder\' and trashed = false' q : 'mimeType != \'application/vnd.google-apps.folder\' and trashed = false'
}) })
.catch((err)=>{ .catch((err)=>{
return console.error(`Error Listing Google Brews: ${err}`); console.log(`Error Listing Google Brews`);
console.error(err);
throw (err);
//TODO: Should break out here, but continues on for some reason. //TODO: Should break out here, but continues on for some reason.
}); });
@@ -135,7 +139,7 @@ GoogleActions = {
const result = await drive.files.get({ fileId: id }) const result = await drive.files.get({ fileId: id })
.catch((err)=>{ .catch((err)=>{
console.log('error checking file exists...'); console.log('error checking file exists...');
console.log(err); console.error(err);
return false; return false;
}); });