Manually handling errors in offline app

I’m building an app running in Chromium Embedded Framework with a local Node process and would like to use Raven for all my error reporting and do away with manually logging errors to a text file (my previous implementation).

I believe this will work 99% of the time as people usually have an internet connection, but I would like to account for the scenario in which the client has no connection.

  1. What is the preferred method of checking whether a Raven transmission is successful, or know if a connection will be made before sending the data?

  2. I am constructing my own feedback form that collects the data that would be sent. Is it possible to manually send the data? Either immediately after the form is filled out (connection is up) or at a later date (connection was unsuccessful)?

  3. Is it possible to get access to the current breadcrumbs manually? I may want users to have the option of filling out a feedback form whenever they like (in case they find a UX error, not an actual thrown error) and want to include the breadcrump info up to that point.

I see that I can get access to the data object using shouldSendCallback, so now I just need to know how I can manually interject in the event that a Raven message can’t be sent automatically, ie. save it to a file that they can email to me, or queue it up to be transmitted to sentry later.

By the way, I’ve never been able to get showReportDialog to work, I always get an error for the GET. Regardless I’d need an offline solution anyway, hence question #2.

I assume you’re talking about raven-js here (browser JavaScript). Note that “Raven” is used to refer to many Sentry clients (e.g. raven-node for Node), so it’s helpful to specify which.

What is the preferred method of checking whether a Raven transmission is successful, or know if a connection will be made before sending the data?

There is an undocumented event system build on the DOM:

document.addEventListener('ravenSuccess', function () { ... });

But there are plans to deprecate this in a future version since not every JavaScript environment has a DOM (e.g. React Native).

I am constructing my own feedback form that collects the data that would be sent. Is it possible to manually send the data? Either immediately after the form is filled out (connection is up) or at a later date (connection was unsuccessful)?

Yes – there is an API method for creating user feedback.

Is it possible to get access to the current breadcrumbs manually? I may want users to have the option of filling out a feedback form whenever they like (in case they find a UX error, not an actual thrown error) and want to include the breadcrump info up to that point.

This use case makes sense; we can introduce a public API method to do so. I recommend opening an issue on raven-js.

I can manually interject in the event that a Raven message can’t be sent automatically, ie. save it to a file that they can email to me, or queue it up to be transmitted to sentry later.

Note that you can replace the transport entirely via setTransport. This means you can open up your own XHR to our API, see if it is successful, and if not store the payload in web storage. The React Native plugin already does this.

By the way, I’ve never been able to get showReportDialog to work, I always get an error for the GET.

Note that it requires an error’s event ID first. If you have one and you’re still getting an error, I’d love to no more so that we can fix it.