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:
@@ -2,7 +2,7 @@ import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
import { safeTry } from "@scandic-hotels/common/utils/safeTry"
|
||||
|
||||
import { router } from "../../.."
|
||||
import { notFound } from "../../../errors"
|
||||
import { notFoundError } from "../../../errors"
|
||||
import {
|
||||
GetDestinationOverviewPage,
|
||||
GetDestinationOverviewPageRefs,
|
||||
@@ -49,21 +49,21 @@ export const destinationOverviewPageQueryRouter = router({
|
||||
|
||||
metricsGetDestinationOverviewPageRefs.start()
|
||||
|
||||
const variables = { locale: lang, uid }
|
||||
const refsResponse = await request<GetDestinationOverviewPageRefsSchema>(
|
||||
GetDestinationOverviewPageRefs,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
variables,
|
||||
{
|
||||
key: generateRefsResponseTag(lang, uid),
|
||||
ttl: "max",
|
||||
}
|
||||
)
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
metricsGetDestinationOverviewPageRefs.noDataError()
|
||||
throw notFoundError
|
||||
throw notFoundError({
|
||||
message: "GetDestinationOverviewPageRefs returned no data",
|
||||
errorDetails: variables,
|
||||
})
|
||||
}
|
||||
|
||||
const validatedRefsData = destinationOverviewPageRefsSchema.safeParse(
|
||||
@@ -89,19 +89,18 @@ export const destinationOverviewPageQueryRouter = router({
|
||||
|
||||
const response = await request<GetDestinationOverviewPageData>(
|
||||
GetDestinationOverviewPage,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
variables,
|
||||
{
|
||||
key: generateTag(lang, uid),
|
||||
ttl: "max",
|
||||
}
|
||||
)
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
metricsGetDestinationOverviewPage.noDataError()
|
||||
throw notFoundError
|
||||
throw notFoundError({
|
||||
message: "GetDestinationOverviewPage returned no data",
|
||||
errorDetails: variables,
|
||||
})
|
||||
}
|
||||
|
||||
const destinationOverviewPage = destinationOverviewPageSchema.safeParse(
|
||||
|
||||
Reference in New Issue
Block a user