-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing stacktrace in renderer process when using Node.js API integration #308
Comments
Currently If we can detect the difference between a Chrome exception and a nodejs exception, we might be able to call into I haven't looked into this for years, but I'm pretty sure Electron in its default configuration rethrows nodejs exceptions in the browser context. I think you might be able to stop that by subscribing to error events on |
Indeed, that's why I get a node-like stack in my renderer process, instead of a chrome-like stack object.
I don't understand, can you elaborate on this? What are we supposed to stop? |
You don't want to catch each exception twice. Once from nodejs, and once from Electron forwarding to Chrome. I seem to remember that subscribing to the nodejs error events disables the re-throwing in the Chrome context. |
That's not what is happening. See my sample code: Node APIs are called from the renderer, and then an error is thrown and is caught a few lines below, in the renderer. |
Sorry, I haven't been very clear there! I understand your issue and it is caused by the fact that I'm saying that to fix your issue, |
Besides, I looked again at my sample stacktrace and it seems there is nothing interesting into, it apart technical framework frames. No function from my application appear. I may have to create new Error objects if I want to have a good stracktrace. Or it is Sentry's responsiblity? try {
const response = await exec(command);
} catch (error) {
console.log('got error', error);
stdout = error.stdout;
if (!stdout) {
const wrappedError = new Error('Unable to run command: ' + error);
Sentry.captureException(wrappedError);
}
... |
Versions + Platform
@sentry/electron@v2.4.0
electron@v11.0.4
macOS
Description
When capturing a exception thrown by the Node integration in the renderer process, the reported stacktrace is empty.
Sample code to reproduce:
The console prints the following (we can see here the value of error.stack):
The error is correctly reported when calling
Sentry.captureException(error)
but in the Sentry web interface the stacktrace is empty. Only the first two lines appear:It seems the Sentry client tries to parse the stack as a Chrome stack, but as the error comes from the Node integration, the format does not match and all frames are skipped.
The text was updated successfully, but these errors were encountered: