Environment
node - 22.19.0
h3 - 2.0.1-rc.14
Reproduction
import { H3, handleCors, HTTPError, serve } from 'h3';
const app = new H3();
app.post('/session', async (event) => {
const corsRes = handleCors(event, {
origin: ['http://localhost:5173'],
});
if (corsRes !== false) {
return corsRes;
}
throw new HTTPError('Invalid Password!');
});
serve(app, {
port: 3000,
});
Describe the bug
When a HTTPError is thrown cors headers are removed, which makes browser clients lose a bunch of relevant information about the error.
According to the docs this is how errors are supposed to be handled and doing throw new Error('message') will result in an unhandled error.
Additional context
No response
Logs
Environment
node - 22.19.0
h3 - 2.0.1-rc.14
Reproduction
Describe the bug
When a HTTPError is thrown cors headers are removed, which makes browser clients lose a bunch of relevant information about the error.
According to the docs this is how errors are supposed to be handled and doing
throw new Error('message')will result in an unhandled error.Additional context
No response
Logs