fix: add ctx to trpc error output.
This commit is contained in:
@@ -19,7 +19,9 @@ export const contentstackBaseProcedure = t.procedure.use(async function (opts) {
|
||||
|
||||
const parsedInput = langInput.safeParse(input)
|
||||
if (!parsedInput.success) {
|
||||
throw badRequestError("Missing Lang in tRPC context")
|
||||
throw badRequestError(
|
||||
`Missing Lang in tRPC context: ${JSON.stringify(opts.ctx)}`
|
||||
)
|
||||
}
|
||||
return opts.next({
|
||||
ctx: {
|
||||
@@ -27,6 +29,7 @@ export const contentstackBaseProcedure = t.procedure.use(async function (opts) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return opts.next({
|
||||
ctx: {
|
||||
lang: opts.ctx.lang,
|
||||
@@ -36,7 +39,9 @@ export const contentstackBaseProcedure = t.procedure.use(async function (opts) {
|
||||
export const contentstackExtendedProcedureUID = contentstackBaseProcedure.use(
|
||||
async function (opts) {
|
||||
if (!opts.ctx.uid) {
|
||||
throw badRequestError("Missing UID in tRPC context")
|
||||
throw badRequestError(
|
||||
`Missing UID in tRPC context: ${JSON.stringify(opts.ctx)}`
|
||||
)
|
||||
}
|
||||
|
||||
return opts.next({
|
||||
|
||||
Reference in New Issue
Block a user