Skip to content

Commit 30b5c80

Browse files
committed
dist
1 parent ff717d5 commit 30b5c80

5 files changed

Lines changed: 23 additions & 23 deletions

File tree

demo/demo.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/maps/demo.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/maps/stackdriver-errors-concat.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/stackdriver-errors-concat.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,14 +2485,19 @@ if (!Array.prototype.forEach) {
24852485
(function(exports) {
24862486
"use strict";
24872487

2488+
/**
2489+
* URL endpoint of the Stackdriver Error Reporting report API.
2490+
*/
2491+
var baseAPIUrl = "https://clouderrorreporting.googleapis.com/v1beta1/projects/";
2492+
24882493
/**
24892494
* An Error handler that sends errors to the Stackdriver Error Reporting API.
24902495
*/
2491-
var StackdriverErrorReporting = function() {};
2492-
exports.StackdriverErrorReporting = StackdriverErrorReporting;
2496+
var StackdriverErrorReporter = function() {};
2497+
exports.StackdriverErrorReporter = StackdriverErrorReporter;
24932498

24942499
/**
2495-
* Initialize the StackdriverErrorReporting object.
2500+
* Initialize the StackdriverErrorReporter object.
24962501
* @param {Object} config - the init configuration.
24972502
* @param {String} config.key - the API key to use to call the API.
24982503
* @param {String} config.projectId - the Google Cloud Platform project ID to report errors to.
@@ -2501,7 +2506,7 @@ if (!Array.prototype.forEach) {
25012506
* @param {Boolean} [config.reportUncaughtExceptions=true] - Set to false to stop reporting unhandled exceptions.
25022507
* @param {Boolean} [config.disabled=false] - Set to true to not report errors when calling report(), this can be used when developping locally.
25032508
*/
2504-
StackdriverErrorReporting.prototype.init = function(config) {
2509+
StackdriverErrorReporter.prototype.start = function(config) {
25052510
if(!config.key) {
25062511
throw new Error('Cannot initialize: No API key provided.');
25072512
}
@@ -2511,23 +2516,17 @@ if (!Array.prototype.forEach) {
25112516

25122517
this.apiKey = config.key;
25132518
this.projectId = config.projectId;
2514-
this.serviceContext = {service: 'web'};
2515-
if(config.service) {
2516-
this.serviceContext.service = config.service;
2517-
}
2519+
this.serviceContext = {service: config.service || 'web'};
25182520
if(config.version) {
25192521
this.serviceContext.version = config.version;
25202522
}
2521-
this.reportUncaughtExceptions = config.reportUncaughtExceptions || true;
2523+
this.reportUncaughtExceptions = !(config.reportUncaughtExceptions === false);
25222524
this.disabled = config.disabled || false;
25232525

25242526
// Register as global error handler if requested
25252527
var that = this;
25262528
if(this.reportUncaughtExceptions) {
2527-
var oldErrorHandler = function(){};
2528-
if(window.onerror) {
2529-
oldErrorHandler = window.onerror;
2530-
}
2529+
var oldErrorHandler = window.onerror || function(){};
25312530

25322531
window.onerror = function(message, source, lineno, colno, error) {
25332532
if(error){
@@ -2542,8 +2541,9 @@ if (!Array.prototype.forEach) {
25422541
/**
25432542
* Report an error to the Stackdriver Error Reporting API
25442543
* @param {Error|String} err - The Error object or message string to report.
2544+
* @param callback - Calback function to be called once error has been reported.
25452545
*/
2546-
StackdriverErrorReporting.prototype.report = function(err, callback) {
2546+
StackdriverErrorReporter.prototype.report = function(err, callback) {
25472547
if(this.disabled) {
25482548
return typeof callback === 'function' && callback();
25492549
}
@@ -2572,21 +2572,21 @@ if (!Array.prototype.forEach) {
25722572
firstFrameIndex = 1;
25732573
}
25742574
var that = this;
2575+
// This will use sourcemaps and normalize the stack frames
25752576
StackTrace.fromError(err).then(function(stack){
25762577
payload.message = err.toString();
25772578
for(var s = firstFrameIndex; s < stack.length; s++) {
25782579
payload.message += '\n';
2579-
// reconstruct the stackframe to look like a JS stackframe.
2580-
// stack[s].source should not be used because not populated created from source map.
2580+
// Reconstruct the stackframe to a JS stackframe as expected by Error Reporting parsers.
2581+
// stack[s].source should not be used because not populated when created from source map.
25812582
payload.message += [' at ', stack[s].getFunctionName(), ' (', stack[s].getFileName(), ':', stack[s].getLineNumber() ,':', stack[s].getColumnNumber() , ')'].join('');
25822583
}
25832584
that.sendErrorPayload(payload, callback);
25842585
});
25852586
};
25862587

2587-
StackdriverErrorReporting.prototype.sendErrorPayload = function(payload, callback) {
2588-
var baseUrl = "https://clouderrorreporting.googleapis.com/v1beta1/projects/";
2589-
var url = baseUrl + this.projectId + "/events:report?key=" + this.apiKey;
2588+
StackdriverErrorReporter.prototype.sendErrorPayload = function(payload, callback) {
2589+
var url = baseAPIUrl + this.projectId + "/events:report?key=" + this.apiKey;
25902590

25912591
var xhr = new XMLHttpRequest();
25922592
xhr.open('POST', url, true);

dist/stackdriver-errors-concat.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)