2022-11-18 18:21:40 +01:00
|
|
|
import { createContext } from '@/utils/server/context'
|
2022-11-22 17:30:20 +01:00
|
|
|
import { appRouter } from '@/utils/server/routers/v1/_app'
|
2022-11-29 10:02:40 +01:00
|
|
|
import { captureException } from '@sentry/nextjs'
|
2022-11-18 18:21:40 +01:00
|
|
|
import { createOpenApiNextHandler } from 'trpc-openapi'
|
|
|
|
|
|
|
|
|
|
export default createOpenApiNextHandler({
|
|
|
|
|
router: appRouter,
|
|
|
|
|
createContext,
|
2022-11-29 10:02:40 +01:00
|
|
|
onError({ error }) {
|
|
|
|
|
if (error.code === 'INTERNAL_SERVER_ERROR') {
|
|
|
|
|
captureException(error)
|
|
|
|
|
console.error('Something went wrong', error)
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-11-18 18:21:40 +01:00
|
|
|
})
|