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,6 +1,6 @@
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import { notFound } from "../../../errors"
|
||||
import { notFoundError } from "../../../errors"
|
||||
import { batchRequest } from "../../../graphql/batchRequest"
|
||||
import {
|
||||
GetContentPageBlocksRefs,
|
||||
@@ -34,10 +34,11 @@ export async function fetchContentPageRefs(lang: Lang, uid: string) {
|
||||
|
||||
metricsGetContentPageRefs.start()
|
||||
|
||||
const variables = { locale: lang, uid }
|
||||
const res = await batchRequest<GetContentPageRefsSchema>([
|
||||
{
|
||||
document: GetContentPageRefs,
|
||||
variables: { locale: lang, uid },
|
||||
variables,
|
||||
cacheOptions: {
|
||||
key: generateRefsResponseTag(lang, uid),
|
||||
ttl: "max",
|
||||
@@ -45,7 +46,7 @@ export async function fetchContentPageRefs(lang: Lang, uid: string) {
|
||||
},
|
||||
{
|
||||
document: GetContentPageBlocksRefs,
|
||||
variables: { locale: lang, uid },
|
||||
variables,
|
||||
cacheOptions: {
|
||||
key: generateTag(lang, uid + 1),
|
||||
ttl: "max",
|
||||
@@ -53,9 +54,11 @@ export async function fetchContentPageRefs(lang: Lang, uid: string) {
|
||||
},
|
||||
])
|
||||
if (!res.data) {
|
||||
const notFoundError = notFound(res)
|
||||
metricsGetContentPageRefs.noDataError()
|
||||
throw notFoundError
|
||||
throw notFoundError({
|
||||
message: "GetContentPageRefs/GetContentPageBlocksRefs returned no data",
|
||||
errorDetails: variables,
|
||||
})
|
||||
}
|
||||
|
||||
const validatedData = contentPageRefsSchema.safeParse(res.data)
|
||||
|
||||
Reference in New Issue
Block a user