Skip to content
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
Copy Markdown
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
Copy Markdown
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