Skip to content

Commit

Permalink
fix: Add console error messages for better logging (#1364)
Browse files Browse the repository at this point in the history
* Add console error messages for better logging

* Improve logging messages

* Nit fix

* Nit fix again
  • Loading branch information
leahecole authored Jun 14, 2019
1 parent 8aeb3d1 commit 3b1b36e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions functions/composer-storage-trigger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ exports.triggerDag = async data => {
iap.jwt
);
} catch (err) {
console.error('Error authorizing IAP:', err.message);
throw new Error(err);
}
};
Expand Down Expand Up @@ -88,6 +89,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
);
const tokenResponse = await res.json();
if (tokenResponse.error) {
console.error('Error in token reponse:', tokenResponse.error.message);
return Promise.reject(tokenResponse.error);
}

Expand Down Expand Up @@ -118,6 +120,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
);
const blobJson = await blob.json();
if (blobJson.error) {
console.error('Error in blob signing:', blobJson.error.message);
return Promise.reject(blobJson.error);
}

Expand All @@ -134,6 +137,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
});
const tokenJson = await token.json();
if (tokenJson.error) {
console.error('Error fetching token:', tokenJson.error.message);
return Promise.reject(tokenJson.error);
}

Expand Down Expand Up @@ -161,6 +165,7 @@ const makeIapPostRequest = async (url, body, idToken, userAgent) => {

if (!res.ok) {
const err = await res.text();
console.error('Error making IAP post request:', err.message);
throw new Error(err);
}
};
Expand Down

0 comments on commit 3b1b36e

Please sign in to comment.