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:
Joakim Jäderberg
2026-01-12 09:01:44 +00:00
parent 575763aaa2
commit 99537b13e8
37 changed files with 641 additions and 293 deletions

View File

@@ -7,7 +7,7 @@ import {
import { createCounter } from "@scandic-hotels/common/telemetry"
import { router } from "../../.."
import { notFound } from "../../../errors"
import { notFoundError } from "../../../errors"
import {
GetAllLoyaltyLevels,
GetLoyaltyLevel,
@@ -48,9 +48,12 @@ export const getAllLoyaltyLevels = cache(async (lang: Lang) => {
)
if (!loyaltyLevelsConfigResponse.data) {
const notFoundError = notFound(loyaltyLevelsConfigResponse)
metricsGetLoyaltyLevelAll.noDataError()
throw notFoundError
throw notFoundError({
message: "GetAllLoyaltyLevels returned no data",
errorDetails: { lang, level_ids: allLevelIds },
})
}
const validatedLoyaltyLevels = validateLoyaltyLevelsSchema.safeParse(
@@ -90,9 +93,11 @@ export const getLoyaltyLevel = cache(
!loyaltyLevelsConfigResponse.data ||
!loyaltyLevelsConfigResponse.data.all_loyalty_level.items.length
) {
const notFoundError = notFound(loyaltyLevelsConfigResponse)
metricsGetLoyaltyLevel.noDataError()
throw notFoundError
throw notFoundError({
message: "GetLoyaltyLevel returned no data",
errorDetails: { lang, level_id },
})
}
const validatedLoyaltyLevels = validateLoyaltyLevelsSchema.safeParse(