fix: add apiResponse.text() to logging

This commit is contained in:
Arvid Norlin
2024-08-23 08:36:14 +02:00
committed by Michael Zetterberg
parent 7cd6367c15
commit 9497e8eef3
6 changed files with 86 additions and 26 deletions
+21 -1
View File
@@ -51,12 +51,14 @@ async function getVerifiedUser({ session }: { session: Session }) {
})
if (!apiResponse.ok) {
const text = await apiResponse.text()
console.error(
"api.user.profile error",
JSON.stringify({
error: {
status: apiResponse.status,
statusText: apiResponse.statusText,
text,
},
})
)
@@ -387,6 +389,7 @@ export const userQueryRouter = router({
// default:
// throw internalServerError(apiResponse)
// }
const text = await apiResponse.text()
console.error(
"api.booking.stays.past error ",
JSON.stringify({
@@ -394,6 +397,7 @@ export const userQueryRouter = router({
error: {
status: apiResponse.status,
statusText: apiResponse.statusText,
text,
},
})
)
@@ -470,6 +474,7 @@ export const userQueryRouter = router({
// default:
// throw internalServerError(apiResponse)
// }
const text = await apiResponse.text()
console.error(
"api.booking.stays.future error ",
JSON.stringify({
@@ -477,6 +482,7 @@ export const userQueryRouter = router({
error: {
status: apiResponse.status,
statusText: apiResponse.statusText,
text,
},
})
)
@@ -544,12 +550,14 @@ export const userQueryRouter = router({
// default:
// throw internalServerError()
// }
const text = await apiResponse.text()
console.error(
"api.transaction.friendTransactions error ",
JSON.stringify({
error: {
status: apiResponse.status,
statusText: apiResponse.statusText,
text,
},
})
)
@@ -645,12 +653,14 @@ export const userQueryRouter = router({
})
if (!apiResponse.ok) {
const text = await apiResponse.text()
console.error(
"api.profile.creditCards error ",
JSON.stringify({
error: {
status: apiResponse.status,
statusText: apiResponse.statusText,
text,
},
})
)
@@ -690,7 +700,17 @@ export const userQueryRouter = router({
// default:
// throw internalServerError()
// }
console.log("api.profile error", JSON.stringify({ error: apiResponse }))
const text = await apiResponse.text()
console.log(
"api.profile error",
JSON.stringify({
error: {
status: apiResponse.status,
statusText: apiResponse.statusText,
text,
},
})
)
}
const apiJson = await apiResponse.json()