Closed tuurbo closed 2 weeks ago
Right, this needs better documentation. Errors are caught by the qwikloader and then emitted as qerror
events.
So you need to add a listener for those and decide what to do with them.
Does that work for you? If you'd like to update the docs with a cookbook for how to handle errors, that'd be greatly appreciated!
Hello @tuurbo. Please provide the missing information requested above.
Issues marked with STATUS-2: missing info
will be automatically closed if they have no activity within 14 days.
Thanks 🙏
qerror
such as
document.addEventListener('qerror', () => {})
?
This worked for me while testing locally. I'm waiting to see if an error comes in from an actual production visitor.
useOnDocument('qerror', $((event: any) => {
const error = event?.detail?.error;
console.error(error);
if (error) {
Sentry.captureException(error);
}
}));
Which component is affected?
Qwik Runtime
Describe the bug
In preview or production (not dev), when a client side error occurs, for example in an onclick$, the error isn't logged to the console. There’s no indication the error even happened, which also prevents an error logger like Sentry from capturing it.
Reproduction
https://github.com/tuurbo/qwik-error-swallowed
Steps to reproduce
Run app in preview
pnpm run preview
or production modepnpm run prod
. Open browser console. Click the buttons.System Info
Additional Information
No response