Last active
March 2, 2024 19:52
-
-
Save nainemom/93650c8efe74714e0fb6ba4193adc2f5 to your computer and use it in GitHub Desktop.
listhen + h3 error capturing issue reproduction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createApp, defineEventHandler, createError } from "h3"; | |
export const app = createApp({ | |
onError: () => console.error('Captured!'), | |
}); | |
app.use('/error', defineEventHandler(async () => { | |
throw createError({ | |
statusCode: 400, | |
}); | |
})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http'; | |
import { toNodeListener } from 'h3'; | |
import { app } from './app.js'; | |
http.createServer(toNodeListener(app)).listen(+process.argv[2]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "listhener", | |
"version": "0.0.0", | |
"type": "module", | |
"scripts": { | |
"start-with-listhen": "listhen ./app.js --port 3000", | |
"start-with-node": "node ./main.js 3000" | |
}, | |
"dependencies": { | |
"h3": "^1.11.1", | |
"listhen": "^1.7.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment