Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add console error messages for better logging #1364

Merged
merged 7 commits into from
Jun 14, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions functions/composer-storage-trigger/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
);
const tokenResponse = await res.json();
if (tokenResponse.error) {
console.error(JSON.stringify(tokenResponse.error));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding something more explanatory to these, and printing out specific error details?

e.g.

console.error('Error in authorizeIap:', tokenResponse.error.message);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely can do that

return Promise.reject(tokenResponse.error);
}

Expand Down Expand Up @@ -118,6 +119,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
);
const blobJson = await blob.json();
if (blobJson.error) {
console.error(JSON.stringify(blobJson.error));
return Promise.reject(blobJson.error);
}

Expand All @@ -134,6 +136,7 @@ const authorizeIap = async (clientId, projectId, userAgent) => {
});
const tokenJson = await token.json();
if (tokenJson.error) {
console.error(JSON.stringify(tokenJson.error));
return Promise.reject(tokenJson.error);
}

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

if (!res.ok) {
const err = await res.text();
console.error(JSON.stringify(err));
throw new Error(err);
}
};
Expand Down