Skip to content
Permalink
Browse files

Added a development flag which allows us to suppress JS errors which …

…happen in development so they're not poluting Sentry.
  • Loading branch information...
SirRawlins committed May 5, 2017
1 parent 2b360ef commit a027a5ea7e18f43bac2c4ef5c8a467f6eb251a79
Showing with 31 additions and 7 deletions.
  1. +6 −0 README.md
  2. +11 −3 dist/status-bar.js
  3. +1 −1 dist/status-bar.min.js
  4. +1 −1 dist/status-bar.min.js.map
  5. +11 −1 src/javascripts/status-bar.js
  6. +1 −1 tests/index.html
@@ -141,6 +141,12 @@ This is a convenience method for watching all the core HTML, CSS and JS assets i

Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun `npm install`.

### Disable error logging

We log all errors within the plugin to [Sentry](https://sentry.io) using [Raven-JS](https://docs.sentry.io/clients/javascript/) so we can keep an eye on the plugin when it's in the field. However during development we don't want these errors logged.

We have a data attribute `<script ... data-environment="development" />` which when set will suppress errors being sent to Sentry, but they'll still be logged in the browsers developer console.

## Versioning

For transparency and insight into our release cycle, and for striving to maintain backward compatibility, This project will be maintained under the Semantic Versioning guidelines as much as possible.

// Configure this instance to hit our Sentry accuont.
raven.config('https://fe8e83188d1d452d9f56e445a82102b6@app.getsentry.com/74508', {
whitelistUrls: [ /status\-bar\.min\.js/ ] // Only track errors in the status bar itself.
// Only track errors in the status bar itself.
whitelistUrls: [ /status\-bar\.min\.js/ ],
// Suppress errors in development environment.
instrument: (function(){
// Check if the environment is set on the script tag.
// TODO: Is there a better way to determine this than finding the script tag?
var environment = $($('script[src$="status-bar.min.js"]')[0]).data('environment');

// See if the environment is set, and is development.
if(typeof(environment) != 'undefined' && environment == 'development') { return false; } else { return true; }
})()
}).install();

/*

// Build the frag for the element.
self.buildFrag();

throw "Too big";
};

StatusNotice.prototype.dismiss = function(e) {

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -39,7 +39,17 @@

// Configure this instance to hit our Sentry accuont.
raven.config('https://fe8e83188d1d452d9f56e445a82102b6@app.getsentry.com/74508', {
whitelistUrls: [ /status\-bar\.min\.js/ ] // Only track errors in the status bar itself.
// Only track errors in the status bar itself.
whitelistUrls: [ /status\-bar\.min\.js/ ],
// Suppress errors in development environment.
instrument: (function(){
// Check if the environment is set on the script tag.
// TODO: Is there a better way to determine this than finding the script tag?
var environment = $($('script[src$="status-bar.min.js"]')[0]).data('environment');

// See if the environment is set, and is development.
if(typeof(environment) != 'undefined' && environment == 'development') { return false; } else { return true; }
})()
}).install();

/*
@@ -22,7 +22,7 @@ <h2 id="qunit-userAgent"></h2>
<script src="vendor/qunit.js"></script>

<!-- Plugin Sources -->
<script src="../dist/status-bar.min.js" data-for="0b4bd6b2"></script>
<script src="../dist/status-bar.min.js" data-for="0b4bd6b2" data-environment="development"></script>

<!-- Unit Tests -->
<script src="unit/status-bar.js"></script>

0 comments on commit a027a5e

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.