Merged in fix/SW-2804-missing-meeting-rooms (pull request #2138)
fix: return [] when we get a 404 for meeting rooms for a hotel * fix: return [] when we get a 404 for meeting rooms for a hotel Approved-by: Linus Flood
This commit is contained in:
@@ -898,8 +898,16 @@ export const hotelQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!apiResponse.ok) {
|
||||
if (apiResponse.status === 404) {
|
||||
// This is expected when the hotel does not have meeting rooms
|
||||
metricsMeetingRooms.success()
|
||||
return []
|
||||
}
|
||||
|
||||
await metricsMeetingRooms.httpError(apiResponse)
|
||||
throw new Error("Failed to fetch meeting rooms")
|
||||
throw new Error("Failed to fetch meeting rooms", {
|
||||
cause: apiResponse,
|
||||
})
|
||||
}
|
||||
|
||||
const apiJson = await apiResponse.json()
|
||||
@@ -909,6 +917,7 @@ export const hotelQueryRouter = router({
|
||||
metricsMeetingRooms.validationError(validatedMeetingRooms.error)
|
||||
throw badRequestError()
|
||||
}
|
||||
|
||||
metricsMeetingRooms.success()
|
||||
|
||||
return validatedMeetingRooms.data.data
|
||||
|
||||
Reference in New Issue
Block a user