Signin  Pricing  Examples  Support

Libraries > airbrake-shim.js

airbrake-shim.js - Search Live Website Code
It's like doing CTRL+F on millions of websites' source code



NerdyData is a search engine for source code. Search the source code of 200 million websites.


JAVASCRIPT FILE https://wow.thinkful.com/static/js/airbrake-shim.js


Libraries on wow.thinkful.com


common.app.js

splash.app.js

airbrake-shim.js



Explore More


hoverIntent.js

jquery-1.10.2.min.js

jquery.base64.js

jquery.formalize.js

airbrake-shim.js
				
// global === window
(function(global) {
// Airbrake shim that stores exceptions until Airbrake notifier is loaded.
global.Airbrake = [];

// Wraps passed function and returns new function that catches and
// reports unhandled exceptions.
global.Airbrake.wrap = function(fn) {
  if (fn.__airbrake__) {
    return fn;
  }

  var airbrakeWrapper = function() {
    var args;
    args = wrapArguments(arguments);
    try {
      return fn.apply(this, args);
    } catch (exc) {
      args = Array.prototype.slice.call(arguments);
      global.Airbrake.push({error: exc, params: {arguments: args}});
      return null;
    }
  }

  airbrakeWrapper.__airbrake__ = true;
  airbrakeWrapper.__inner__ = fn;

  var prop;
  for (prop in fn) {
    if (fn.hasOwnProperty(prop)) {
      airbrakeWrapper[prop] = fn[prop];
    }
  }

  return airbrakeWrapper;
}

// Registers console reporter when notifier is ready.
global.Airbrake.onload = function() {
  Airbrake.addReporter(Airbrake.consoleReporter);
}

// Reports unhandled exceptions.
global.onerror = function(message, file, line, column, error) {
  if (message === 'Script error.') {
    // Ignore.
    return;
  }

  if (error) {
    global.Airbrake.push({error: error});
  } else {
    global.Airbrake.push({error: {
      message: message,
      fileName: file,
      lineNumber: line,
      columnNumber: column || 0
    }});
  }
}

var loadAirbrakeNotifier = function() {
  var script = document.createElement('script'),
      sibling = document.getElementsByTagName('script')[0];
  script.src = 'https://ssljscdn.airbrake.io/0.3/airbrake.min.js';
  script.async = true;
  sibling.parentNode.insertBefore(script, sibling);
}

var wrapArguments = function(args) {
  var i;
  for (i = 0; i < args.length; i++) {
    var arg = args[i],
        type = typeof arg;
    if (type === 'function') {
      args[i] = global.Airbrake.wrap(arg);
    } else if (arg && arg.length && type !== 'string') {
      // Wrap recursively.
      args[i] = wrapArguments(arg);
    }
  }
  return args;
}

// Asynchronously loads Airbrake notifier.
if (global.addEventListener) {
  global.addEventListener('load', loadAirbrakeNotifier, false);
} else if (global.attachEvent) {
  global.attachEvent('onload', loadAirbrakeNotifier);
}

})(this);


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z