Skip to content

Commit

Permalink
Merge pull request #234 from jill64/dev
Browse files Browse the repository at this point in the history
chore: skip report for testing errors
  • Loading branch information
wraith-ci[bot] authored Dec 7, 2023
2 parents 88a0c98 + f2b3fb3 commit acd69b2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
23 changes: 14 additions & 9 deletions demo/src/hooks.client.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { init } from '$dist/client'
import { errorForTesting } from './tesingErrors'

const onError = init(
'https://7e30b84f392c05d4a9a21e30f3ef6801@o4505814639312896.ingest.sentry.io/4505817123323904'
'https://7e30b84f392c05d4a9a21e30f3ef6801@o4505814639312896.ingest.sentry.io/4505817123323904',
{
sentryOptions: {
beforeSend: (event) =>
errorForTesting.includes(event.exception?.values?.[0].value ?? '')
? null
: event
}
}
)

export const handleError = onError((e, sentryEventId) => {
console.error(e)

return {
message: 'This error was successfully sent to Sentry',
sentryEventId
}
})
export const handleError = onError((_, sentryEventId) => ({
message: 'This error was successfully sent to Sentry',
sentryEventId
}))
28 changes: 15 additions & 13 deletions demo/src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { init } from '$dist/server'
import { errorForTesting } from './tesingErrors'

const { onHandle, onError } = init(
'https://7e30b84f392c05d4a9a21e30f3ef6801@o4505814639312896.ingest.sentry.io/4505817123323904'
'https://7e30b84f392c05d4a9a21e30f3ef6801@o4505814639312896.ingest.sentry.io/4505817123323904',
{
toucanOptions: {
beforeSend: (event) =>
errorForTesting.includes(event.exception?.values?.[0].value ?? '')
? null
: event
}
}
)

export const handle = onHandle(({ event, resolve }) => {
console.log(`${event.request.method} ${event.url.pathname}`)
return resolve(event)
})

export const handleError = onError((e, sentryEventId) => {
console.error(e)
export const handle = onHandle()

return {
message: 'This error was successfully sent to Sentry',
sentryEventId
}
})
export const handleError = onError((_, sentryEventId) => ({
message: 'This error was successfully sent to Sentry',
sentryEventId
}))
8 changes: 8 additions & 0 deletions demo/src/tesingErrors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const errorForTesting = [
'Universal Layout Load Error',
'Layout Server Load Error',
'Universal Page Load Error',
'Page Server Load Error',
'PATCH Error',
'DELETE Error'
]

0 comments on commit acd69b2

Please sign in to comment.