chore: bump up Hono; support new error handling (#6)
parent
a85c140e66
commit
2460e82976
|
@ -33,7 +33,7 @@
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hono": "^2.0.6",
|
"hono": "^2.2.5",
|
||||||
"toucan-js": "^2.6.1"
|
"toucan-js": "^2.6.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -48,11 +48,9 @@ export const sentry = (options?: Options, callback?: (sentry: Toucan) => void):
|
||||||
c.set('sentry', sentry)
|
c.set('sentry', sentry)
|
||||||
if (callback) callback(sentry)
|
if (callback) callback(sentry)
|
||||||
|
|
||||||
try {
|
|
||||||
await next()
|
await next()
|
||||||
} catch (error) {
|
if (c.error) {
|
||||||
sentry.captureException(error)
|
sentry.captureException(c.error)
|
||||||
throw error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ describe('Sentry middleware', () => {
|
||||||
|
|
||||||
app.use('/sentry/*', sentry(undefined, callback))
|
app.use('/sentry/*', sentry(undefined, callback))
|
||||||
app.get('/sentry/foo', (c) => c.text('foo'))
|
app.get('/sentry/foo', (c) => c.text('foo'))
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
app.get('/sentry/bar', (c) => getSentry(c).log('bar') || c.text('bar'))
|
app.get('/sentry/bar', (c) => getSentry(c).log('bar') || c.text('bar'))
|
||||||
app.get('/sentry/error', () => {
|
app.get('/sentry/error', () => {
|
||||||
throw new Error('a catastrophic error')
|
throw new Error('a catastrophic error')
|
||||||
|
|
|
@ -2280,10 +2280,10 @@ has@^1.0.3:
|
||||||
dependencies:
|
dependencies:
|
||||||
function-bind "^1.1.1"
|
function-bind "^1.1.1"
|
||||||
|
|
||||||
hono@^2.0.6:
|
hono@^2.2.5:
|
||||||
version "2.0.6"
|
version "2.2.5"
|
||||||
resolved "https://registry.yarnpkg.com/hono/-/hono-2.0.6.tgz#fa4b17905a6fb187114beef3eebce13f163de99b"
|
resolved "https://registry.yarnpkg.com/hono/-/hono-2.2.5.tgz#c0258d796d1e48e2b83b76f915a24c14fdf4f289"
|
||||||
integrity sha512-HgtiYdmBm4gayQ/IEUNbzQgBlEQdoN57F8A8QmtlqqoCgNvFNZ7J7KKEHiZHm4sviZ0SndBhQMlvkjupW0J3rg==
|
integrity sha512-qIOLwQYJrTGwSSLahXvQ60nJT+NhZqsf+zSvj3eitBPCxpb+bsA2cl4clJzo1WNB+3KdxAdfVmUzq2stzby3eg==
|
||||||
|
|
||||||
html-escaper@^2.0.0:
|
html-escaper@^2.0.0:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
|
|
Loading…
Reference in New Issue