Skip to content

Commit

Permalink
Log response body for failed identity requests (#44)
Browse files Browse the repository at this point in the history
* Log identity response when account creation fails

* better
  • Loading branch information
tomrf1 authored Aug 9, 2021
1 parent 792ab9f commit 6c65598
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
12 changes: 8 additions & 4 deletions src/create-reminder-signup/lib/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ const createIdentityAccount = async (
IDENTITY_ACCOUNT_CREATION_MAX_RETRIES,
);
if (!response.ok) {
console.log(
`Identity guest account creation failed with status ${response.status}`,
);
return fail(response.status);
return response.text().then((body) => {
console.log(
'Identity guest account creation failed',
response.status,
body,
);
return fail(response.status);
});
}

return response.json().then((identityResponse) => {
Expand Down
14 changes: 8 additions & 6 deletions src/lib/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ export const getIdentityIdByEmail = async (
);

if (!response.ok) {
console.log(
`Failed to get identity ID for email ${email}`,
response.status,
response,
);
return fail(response.status);
return response.text().then((body) => {
console.log(
`Failed to get identity ID for email ${email}`,
response.status,
body,
);
return fail(response.status);
});
}

return response.json().then((identityResponse) => {
Expand Down

0 comments on commit 6c65598

Please sign in to comment.