Merged in fix/capture-errors-in-trpc (pull request #2103)
Fix/capture errors in trpc * fix: import @sentry/nextjs, not @sentry/node * add sentry logging for errors in trpc Approved-by: Linus Flood
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import * as Sentry from "@sentry/nextjs"
|
||||||
import { TRPCError } from "@trpc/server"
|
import { TRPCError } from "@trpc/server"
|
||||||
import { redirect } from "next/navigation"
|
import { redirect } from "next/navigation"
|
||||||
|
|
||||||
@@ -49,6 +50,19 @@ export function serverClient() {
|
|||||||
redirect(redirectUrl)
|
redirect(redirectUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sentry.captureException(error, {
|
||||||
|
extra: {
|
||||||
|
input,
|
||||||
|
path,
|
||||||
|
type,
|
||||||
|
url: ctx?.url,
|
||||||
|
lang: ctx?.lang,
|
||||||
|
pathname: ctx?.pathname,
|
||||||
|
contentType: ctx?.contentType,
|
||||||
|
uid: ctx?.uid,
|
||||||
|
},
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import * as Sentry from "@sentry/node"
|
import * as Sentry from "@sentry/nextjs"
|
||||||
import { initTRPC } from "@trpc/server"
|
import { initTRPC } from "@trpc/server"
|
||||||
import { experimental_nextAppDirCaller } from "@trpc/server/adapters/next-app-dir"
|
import { experimental_nextAppDirCaller } from "@trpc/server/adapters/next-app-dir"
|
||||||
import { ZodError } from "zod"
|
import { ZodError } from "zod"
|
||||||
|
|||||||
Reference in New Issue
Block a user