WorldBrain / Memex

Browser extension to curate, annotate, and discuss the most valuable content and ideas on the web. As individuals, teams and communities.
https://worldbrain.io
4.42k stars 336 forks source link

Capturing common IDB errors before sending to sentry #494

Open poltak opened 6 years ago

poltak commented 6 years ago

Feature freeze task. Need somewhere to write what I found out

Sentry gets spammed with the same IDB/Dexie errors, like QuotaExceededError, every time we publish a new version. Most of these seem to be completely out of our control and the sheer volume of them really makes it difficult to see the actual important errors that we have accidentally introduced in new changes in the codebase.

All of these errors should be going to the DOM's unhandledrejection event (http://dexie.org/docs/Promise/unhandledrejection-event) in the background script, so we should be able to tap into that to handle them. The main issue is raven-js/sentry also uses that same event to track errors by default (https://docs.sentry.io/clients/javascript/usage/#promises). So we would need to disable sentry's default behaviour, write our own unhandledrejection event handler, and explicitly forward them onto sentry if the errors are unknown (although only in the background script).

Unknowns

Future ideas

poltak commented 6 years ago

Sadly this unhandledrejection seems to be unsupported in FF although it's in progress: https://bugzilla.mozilla.org/show_bug.cgi?id=1362272 I haven't found any alternative to this, so I will probably have to catch these specific errors wherever we are interacting with Dexie. Less work for the newer code that uses StorageManager, but the non-StorageManager search is still a very large interface.