Merged in feat/sentry (pull request #1089)
This commit is contained in:
committed by
Joakim Jäderberg
parent
e0c5b59860
commit
3982b1ba56
@@ -1,5 +1,5 @@
|
||||
"use client"
|
||||
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import { useEffect } from "react"
|
||||
|
||||
export default function Error({
|
||||
@@ -8,7 +8,10 @@ export default function Error({
|
||||
error: Error & { digest?: string }
|
||||
}) {
|
||||
useEffect(() => {
|
||||
if (!error) return
|
||||
|
||||
console.error({ breadcrumbsError: error })
|
||||
Sentry.captureException(error)
|
||||
}, [error])
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import { useEffect } from "react"
|
||||
|
||||
export default function Error({
|
||||
@@ -8,7 +9,10 @@ export default function Error({
|
||||
error: Error & { digest?: string }
|
||||
}) {
|
||||
useEffect(() => {
|
||||
console.error({ breadcrumbsError: error })
|
||||
if (!error) return
|
||||
|
||||
console.error(error)
|
||||
Sentry.captureException(error)
|
||||
}, [error])
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
"use client"
|
||||
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import { useEffect } from "react"
|
||||
|
||||
import type { ErrorPage } from "@/types/next/error"
|
||||
|
||||
export default function ProfileError({ error }: ErrorPage) {
|
||||
console.error(error)
|
||||
useEffect(() => {
|
||||
if (!error) return
|
||||
|
||||
console.error(error)
|
||||
Sentry.captureException(error)
|
||||
}, [error])
|
||||
|
||||
return <h1>Error happened, Profile</h1>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client" // Error components must be Client Components
|
||||
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import {
|
||||
useParams,
|
||||
usePathname,
|
||||
@@ -33,13 +33,17 @@ export default function Error({
|
||||
const isFirstLoadRef = useRef<boolean>(true)
|
||||
|
||||
useEffect(() => {
|
||||
// Log the error to an error reporting service
|
||||
if (!error) return
|
||||
|
||||
console.error(error)
|
||||
|
||||
if (error.message === SESSION_EXPIRED) {
|
||||
const loginUrl = login[params.lang]
|
||||
window.location.assign(loginUrl)
|
||||
return
|
||||
}
|
||||
|
||||
Sentry.captureException(error)
|
||||
}, [error, params.lang])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
"use client"
|
||||
|
||||
export default function Error() {
|
||||
import * as Sentry from "@sentry/nextjs"
|
||||
import { useEffect } from "react"
|
||||
|
||||
export default function Error({
|
||||
error,
|
||||
}: {
|
||||
error: Error & { digest?: string }
|
||||
}) {
|
||||
useEffect(() => {
|
||||
if (!error) return
|
||||
|
||||
console.error(error)
|
||||
Sentry.captureException(error)
|
||||
}, [error])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user