fix: change bad JSON.stringify:s
This commit is contained in:
@@ -51,11 +51,15 @@ export const accountPageQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
console.error(
|
||||
"contentstack.accountPage.refs not found error",
|
||||
JSON.stringify({ query: { lang, uid }, error: refsResponse })
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(refsResponse)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const cleanedData = removeEmptyObjects(refsResponse.data)
|
||||
@@ -93,14 +97,15 @@ export const accountPageQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error(
|
||||
"contentstack.accountPage not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: response,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedAccountPage = validateAccountPageSchema.safeParse(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { error } from "console"
|
||||
|
||||
import { GetContactConfig } from "@/lib/graphql/Query/ContactConfig.graphql"
|
||||
import {
|
||||
GetCurrentFooter,
|
||||
@@ -42,11 +44,12 @@ export const baseQueryRouter = router({
|
||||
})
|
||||
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error(
|
||||
"contentstack.config not found error",
|
||||
JSON.stringify({ query: { lang }, error: response })
|
||||
JSON.stringify({ query: { lang }, error: { code: notFoundError.code } })
|
||||
)
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedContactConfigConfig = validateContactConfigSchema.safeParse(
|
||||
@@ -101,16 +104,17 @@ export const baseQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error(
|
||||
"contentstack.header not found error",
|
||||
JSON.stringify({
|
||||
query: {
|
||||
lang: input.lang,
|
||||
},
|
||||
error: response,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedHeaderConfig = validateHeaderConfigSchema.safeParse(
|
||||
@@ -179,16 +183,17 @@ export const baseQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error(
|
||||
"contentstack.footer not found error",
|
||||
JSON.stringify({
|
||||
query: {
|
||||
lang: input.lang,
|
||||
},
|
||||
error: response,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedFooterConfig = validateFooterConfigSchema.safeParse(
|
||||
|
||||
@@ -19,14 +19,15 @@ export const hotelPageQueryRouter = router({
|
||||
uid,
|
||||
})
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error(
|
||||
"contentstack.hotelPage not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: response,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedHotelPage = validateHotelPageSchema.safeParse(response.data)
|
||||
|
||||
@@ -55,6 +55,7 @@ export const loyaltyPageQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
console.error(
|
||||
"contentstack.loyaltyPage.refs not found error",
|
||||
JSON.stringify({
|
||||
@@ -62,10 +63,10 @@ export const loyaltyPageQueryRouter = router({
|
||||
lang,
|
||||
uid,
|
||||
},
|
||||
error: JSON.stringify(refsResponse),
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(refsResponse)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const cleanedData = removeEmptyObjects(refsResponse.data)
|
||||
@@ -110,14 +111,15 @@ export const loyaltyPageQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error(
|
||||
"contentstack.loyaltyPage not found error",
|
||||
JSON.stringify({
|
||||
query: { lang, uid },
|
||||
error: response,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const blocks = response.data.loyalty_page.blocks
|
||||
|
||||
@@ -76,16 +76,17 @@ export const navigationQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!refsResponse.data) {
|
||||
const notFoundError = notFound(refsResponse)
|
||||
console.error(
|
||||
"contentstack.myPages.navigation.refs not found error",
|
||||
JSON.stringify({
|
||||
query: {
|
||||
lang,
|
||||
},
|
||||
error: refsResponse,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
)
|
||||
throw notFound(refsResponse)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedMyPagesNavigationRefs =
|
||||
@@ -127,13 +128,14 @@ export const navigationQueryRouter = router({
|
||||
)
|
||||
|
||||
if (!response.data) {
|
||||
const notFoundError = notFound(response)
|
||||
console.error("contentstack.myPages.navigation not found error", {
|
||||
query: {
|
||||
lang,
|
||||
},
|
||||
error: response,
|
||||
error: { code: notFoundError.code },
|
||||
})
|
||||
throw notFound(response)
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
const validatedMyPagesNavigation = navigationPayloadSchema.safeParse(
|
||||
|
||||
@@ -54,7 +54,10 @@ export const hotelQueryRouter = router({
|
||||
"api.hotels.hotel error",
|
||||
JSON.stringify({
|
||||
query: { hotelId, params: params.toString() },
|
||||
error: apiResponse,
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
return null
|
||||
|
||||
@@ -54,7 +54,10 @@ async function getVerifiedUser({ session }: { session: Session }) {
|
||||
console.error(
|
||||
"api.user.profile error",
|
||||
JSON.stringify({
|
||||
error: apiResponse,
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
if (apiResponse.status === 401) {
|
||||
@@ -303,7 +306,12 @@ export const userQueryRouter = router({
|
||||
if (!previousStaysResponse.ok) {
|
||||
console.error(
|
||||
"api.booking.stays.past error",
|
||||
JSON.stringify({ error: previousStaysResponse })
|
||||
JSON.stringify({
|
||||
error: {
|
||||
status: previousStaysResponse.status,
|
||||
statusText: previousStaysResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
return notLoggedInUserTrackingData
|
||||
}
|
||||
@@ -383,7 +391,10 @@ export const userQueryRouter = router({
|
||||
"api.booking.stays.past error ",
|
||||
JSON.stringify({
|
||||
query: { params: params.toString() },
|
||||
error: apiResponse,
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
return null
|
||||
@@ -463,7 +474,10 @@ export const userQueryRouter = router({
|
||||
"api.booking.stays.future error ",
|
||||
JSON.stringify({
|
||||
query: { params: params.toString() },
|
||||
error: apiResponse,
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
return null
|
||||
@@ -532,7 +546,12 @@ export const userQueryRouter = router({
|
||||
// }
|
||||
console.error(
|
||||
"api.transaction.friendTransactions error ",
|
||||
JSON.stringify({ error: apiResponse })
|
||||
JSON.stringify({
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
return null
|
||||
}
|
||||
@@ -628,7 +647,12 @@ export const userQueryRouter = router({
|
||||
if (!apiResponse.ok) {
|
||||
console.error(
|
||||
"api.profile.creditCards error ",
|
||||
JSON.stringify({ error: apiResponse })
|
||||
JSON.stringify({
|
||||
error: {
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
},
|
||||
})
|
||||
)
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user