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 { GetCollectionPageRefs } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql"
|
||||
import { request } from "../../../graphql/request"
|
||||
import {
|
||||
@@ -32,13 +32,13 @@ export async function fetchCollectionPageRefs(lang: Lang, uid: string) {
|
||||
metricsGetCollectionPageRefs.start()
|
||||
|
||||
const cacheKey = generateRefsResponseTag(lang, uid)
|
||||
|
||||
const variables = {
|
||||
locale: lang,
|
||||
uid,
|
||||
}
|
||||
const refsResponse = await request<GetCollectionPageRefsSchema>(
|
||||
GetCollectionPageRefs,
|
||||
{
|
||||
locale: lang,
|
||||
uid,
|
||||
},
|
||||
variables,
|
||||
{
|
||||
key: cacheKey,
|
||||
ttl: "max",
|
||||
@@ -46,9 +46,11 @@ export async function fetchCollectionPageRefs(lang: Lang, uid: string) {
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
metricsGetCollectionPageRefs.noDataError()
|
||||
throw notFoundError
|
||||
throw notFoundError({
|
||||
message: "GetCollectionPageRefs returned no data",
|
||||
errorDetails: variables,
|
||||
})
|
||||
}
|
||||
|
||||
return refsResponse.data
|
||||
|
||||
Reference in New Issue
Block a user