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 { getCacheClient } from "@scandic-hotels/common/dataCache"
|
||||
import { createCounter } from "@scandic-hotels/common/telemetry"
|
||||
|
||||
import * as api from "../../../api"
|
||||
import { notFound } from "../../../errors"
|
||||
import { notFoundError } from "../../../errors"
|
||||
import {
|
||||
GetRewards as GetRewards,
|
||||
GetRewardsRef as GetRewardsRef,
|
||||
@@ -109,9 +109,12 @@ export async function getCmsRewards(lang: Lang, rewardIds: string[]) {
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
metricsGetContentstackRewardAllRefs.noDataError()
|
||||
throw notFoundError
|
||||
|
||||
throw notFoundError({
|
||||
message: "GetRewardsRef returned no data",
|
||||
errorDetails: { lang, rewardIds },
|
||||
})
|
||||
}
|
||||
|
||||
const validatedRefsData = rewardRefsSchema.safeParse(refsResponse)
|
||||
@@ -144,9 +147,12 @@ export async function getCmsRewards(lang: Lang, rewardIds: string[]) {
|
||||
)
|
||||
|
||||
if (!cmsRewardsResponse.data) {
|
||||
const notFoundError = notFound(cmsRewardsResponse)
|
||||
metricsGetContentstackRewardAll.noDataError()
|
||||
throw notFoundError
|
||||
|
||||
throw notFoundError({
|
||||
message: "GetRewards not found",
|
||||
errorDetails: { lang, rewardIds },
|
||||
})
|
||||
}
|
||||
|
||||
const validatedCmsRewards =
|
||||
|
||||
Reference in New Issue
Block a user