Skip to content

Commit

Permalink
Capture SWR errors (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
jribbink authored Oct 31, 2024
1 parent 1a28b48 commit a43795c
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { AdaptiveModal } from '../components/layout/AdaptiveModal'
import { DeviceProvider } from '../contexts/DeviceContext'
import App, { AppContext, AppProps } from 'next/app'
import { ColorModeSync } from '../components/ColorModeSync'
import { SWRConfig } from 'swr'
import * as Sentry from '@sentry/nextjs'

function MyApp({
Component,
Expand All @@ -19,14 +21,20 @@ function MyApp({
}

return (
<ChakraProvider theme={theme}>
<ColorModeSync />
<DeviceProvider userAgent={pageProps.userAgent}>
<AdaptiveModal isOpen={isOpen} onClose={handleOnClose}>
<Component {...pageProps} />
</AdaptiveModal>
</DeviceProvider>
</ChakraProvider>
<SWRConfig
value={{
onError: (err, key) => Sentry.captureException(err, { extra: { key } }),
}}
>
<ChakraProvider theme={theme}>
<ColorModeSync />
<DeviceProvider userAgent={pageProps.userAgent}>
<AdaptiveModal isOpen={isOpen} onClose={handleOnClose}>
<Component {...pageProps} />
</AdaptiveModal>
</DeviceProvider>
</ChakraProvider>
</SWRConfig>
)
}

Expand Down

0 comments on commit a43795c

Please sign in to comment.