// See it.com.atlassian.stash.rules.JavaScriptErrorRule
;(function(window) { // eslint-disable-line no-extra-semi

    'use strict';

    var originalOnError = window.onerror;

    window.onerror = function(message, scriptUrl, lineNumber) {
        var collectedErrors = window.collectedErrors = window.collectedErrors || [];
        collectedErrors.push(message + '. at ' + scriptUrl + ' line ' + lineNumber);

        if (originalOnError) {
            originalOnError.apply(this, arguments);
        }
    };

})(window);