Merged in chore/add-error-details-for-sentry (pull request #3378)
Include more details when throwing errors for debugging in Sentry * WIP throw errors with more details for debugging in Sentry * Fix throwing response-data * Clearer message when a response fails * Add message to errors * better typings * . * Try to send profileID and membershipNumber to Sentry when we fail to parse the apiResponse * rename notFound -> notFoundError * Merge branch 'master' of bitbucket.org:scandic-swap/web into chore/add-error-details-for-sentry Approved-by: Linus Flood
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import * as api from "../../api"
|
||||
import { badRequestError, serverErrorByStatus } from "../../errors"
|
||||
import {
|
||||
badRequestError,
|
||||
extractResponseDetails,
|
||||
serverErrorByStatus,
|
||||
} from "../../errors"
|
||||
import { toApiLang } from "../../utils"
|
||||
import { createBookingSchema } from "./mutation/create/schema"
|
||||
import { bookingConfirmationSchema } from "./output"
|
||||
@@ -37,7 +41,11 @@ export async function getBooking(
|
||||
return null
|
||||
}
|
||||
|
||||
throw serverErrorByStatus(apiResponse.status, apiResponse)
|
||||
throw serverErrorByStatus(
|
||||
apiResponse.status,
|
||||
await extractResponseDetails(apiResponse),
|
||||
"getBooking failed"
|
||||
)
|
||||
}
|
||||
|
||||
const apiJson = await apiResponse.json()
|
||||
@@ -94,7 +102,11 @@ export async function findBooking(
|
||||
return null
|
||||
}
|
||||
|
||||
throw serverErrorByStatus(apiResponse.status, apiResponse)
|
||||
throw serverErrorByStatus(
|
||||
apiResponse.status,
|
||||
await extractResponseDetails(apiResponse),
|
||||
"findBooking failed"
|
||||
)
|
||||
}
|
||||
|
||||
const apiJson = await apiResponse.json()
|
||||
|
||||
Reference in New Issue
Block a user