Repository navigation
Feature request: showReportDialog for uncaught exceptions #796
Description
Activity
@cldwalker – using
showReportDialogwith uncaught exceptions is ... what it's for. Can you clarify?Sure. The JS example shows an example of caught exception usage. It seems there isn't a way clien-tside for an uncaught exception to automatically trigger
showReportDialog. I searched the forum but haven't seen anyone attempt to use it in that way. Perhaps I could override some internal sentry uncaughtException handler but that seems brittle from a usage and perhaps even a timing perspective (having the right eventid)Reacted by Albin Larsson, Mattias Petter Johansson and Mateusz KlimekTechnically it works for uncaught exceptions too. You could do the following:
Raven.setDataCallback(function (data) { // means an error was triggered Raven.showReportDialog(); // uses last event id });
That doesn't seem to work @benvinegar:
Raven.setDataCallback()is triggered before the event id is created (which I'm assuming is happening on the server)By reading the source I figured out another way though.
document.addEventListener('ravenSuccess', function () {
Raven.showReportDialog();
}, false);Edit: Although that^ works, this should be safer, to make sure you have the right event id:
document.addEventListener('ravenSuccess', function (event) { Raven.showReportDialog({eventId: event.data.event_id}); }, false);
Reacted by Thomas Eizinger, Chris, Jonas Rosado and Yuriy Babak@benvinegar @friday I am having this problem too. However, I'm sceptical of the solution that @friday posted - partly because it's not obvious what ravenSuccess entails as an event, and also, I cannot seem to locate that string anywhere in the raven-js source.
@mpj: The "success" part of ravenSuccess refers to the request for the error report. It's not documented, but you can see how it works here (and why you couldn't search for it): https://github.com/getsentry/raven-js/blob/d88422c2e5409bef914975b3dbd858e09d866f27/src/raven.js#L730
(called from here: https://github.com/getsentry/raven-js/blob/d88422c2e5409bef914975b3dbd858e09d866f27/src/raven.js#L1636).It could be potentially dangerous if they removed the event or started using it differently, so you're probably right to be sceptical. Also: I stopped using
showReportDialog(for other reasons), so I don't know the status of the code I posted.Update: I tested this and it still works. I also updated the code above to use the actual event id rather than the last one.
@friday thanks SO much for your assistance, very helpful!
Reacted by Albin Larsson@friday Thanks soo much! I was trying for hours to make this work! 🎉
Reacted by Albin LarssonSeems to me that the solution above does not work anymore @3.26.4 :(
Raven.config('https://be0af717412a423f84c9f8a7ab6a43a0@sentry.io/1245111').install() document.addEventListener( 'ravenSuccess', event => { console.log(event) && Raven.showReportDialog({ eventId: event.data.event_id }) }, false )
I don't get the event in my console and I see no dialog. The events are reported properly to Sentry though.
I also tried the other approach, like
Raven.setDataCallback(function (data) { // means an error was triggered Raven.showReportDialog(); // uses last event id });
I get an error:
RavenConfigError: Missing eventIdThen I tried
Raven.setDataCallback(data => { // means an error was triggered Raven.showReportDialog({ eventId: data.event_id }) // uses last event id })
Which gives me the same error message
That's strange, because if I don't call the
showReportDialog, I can get the event ID from the data.I get
undefinedwhen reading the property directly, but if I log thedataobject, theevent_idis there. BUT As soon as I add theshowReportDialogit's not there anymore.Raven.setDataCallback(data => { console.log({ eventId: data.event_id }) // {eventId: undefined} console.log({ data }) // {data: {.... event_id: 12345}} })
Raven.setDataCallback(data => { console.log({ eventId: data.event_id }) // {eventId: undefined} console.log({ data }) // {data: {.... }} <---- no event-ID in object Raven.showReportDialog({ eventId: data.event_id }) })
@esbenvb:
console.log()doesn't return anything, so that's why it won't work.My example may still be broken though. I'm not using this any more, as mentioned, and it's internal undocumented API so using it is risky.
This is fixed in new SDK:
init({ dsn: '__DSN__', beforeSend(event) { // event.event_id is now always available } });
Reacted by Albin Larsson- added a commit that references this issue
on Oct 5, 2026

Hi,
The report dialogs look great and it would be great to display it with uncaught exceptions. I don't currently see a config option to allow this and haven't seen discussion of this in your forum or github. Keep up the great work!
Cheers