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,7 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import { router } from "../../.."
|
||||
import { notFound } from "../../../errors"
|
||||
import { notFoundError } from "../../../errors"
|
||||
import { GetHotelPage } from "../../../graphql/Query/HotelPage/HotelPage.graphql"
|
||||
import { request } from "../../../graphql/request"
|
||||
import { contentstackExtendedProcedureUID } from "../../../procedures"
|
||||
@@ -21,12 +21,10 @@ export const hotelPageQueryRouter = router({
|
||||
|
||||
metricsGetHotelPage.start()
|
||||
|
||||
const variables = { locale: lang, uid }
|
||||
const hotelPageResponse = await request<GetHotelPageData>(
|
||||
GetHotelPage,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
variables,
|
||||
{
|
||||
key: generateTag(lang, uid),
|
||||
ttl: "max",
|
||||
@@ -34,9 +32,12 @@ export const hotelPageQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!hotelPageResponse.data) {
|
||||
const notFoundError = notFound(hotelPageResponse)
|
||||
metricsGetHotelPage.noDataError()
|
||||
throw notFoundError
|
||||
|
||||
throw notFoundError({
|
||||
message: "GetHotelPage returned no data",
|
||||
errorDetails: variables,
|
||||
})
|
||||
}
|
||||
|
||||
const validatedHotelPage = hotelPageSchema.safeParse(hotelPageResponse.data)
|
||||
|
||||
Reference in New Issue
Block a user