Notification on error?

Looking for general advice: Any recommendations on how to generate a notification (email,sms,etc.) when my deployment has an error that causes a disconnection from the server?

For background:

  • I understand I can use onSessionEnded, but I'm particularly concerned with cases where the error causes a crash, not a time out or a closing of the browser window.
  • I know there are a number of packages that can generate SMS/email alerts, so I'm less concerned about picking one of those (unless you have a recommendation!).
  • I could also try wrapping some particular function calls with tryCatch, but I'd like something a little more general, since there are a few places throughout my code where I'm looking for issues.
  • Is there anyway to programmatically scan logs for errors, or is the only solution through code in the app itself? Javascript alternatives?
  • My particular issue is that we've seen some sporadic API outages and other infrequent issues pulling from some source data. If things do go down, having this kind of notification handy would help in letting users know about the outage, being able to quickly debug while the issue is 'live', and in addition, if any other bug arises in the app, I'd just sleep a little easier knowing I'd get a notification about an error out (especially for cases where users are reluctant to file a report).

Many thanks in advance!

I don't know about on itself, but you could set up a scheduled export of the logs via rsconnect::showLogs() to a database somewhere, then scan that for the crash logs and send a notification.