Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jessicard/cb3792fd22a603c028df to your computer and use it in GitHub Desktop.
Content Scripts
// In your extension's index.html you'll also need to include Bugsnag and disable auto-notification:
// <script src="bugsnag-2.min.js" data-apiKey="your-api-key" data-autoNotify="false">
// You can then add try/catch blocks in your content scripts, and pass any errors back up to your extension:
// Inside your content script
try {
// Some code in your content scripts
} catch(e) {
var exceptionObj = {stack: e.stack, message: e.message, name:};
chrome.runtime.sendMessage("extension-id", {type: "error", exception: exceptionObj});
// Then in your extension code you could listen for this message and notify Bugsnag:
// Inside your extension
chrome.runtime.onMessage.addListener(function (message) {
if(message.type == "error") {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment