in asdoc/library/closure/goog/debug/errorhandler.js [173:227]
var googDebugErrorHandlerProtectedFunction = function() {
var self = /** @type {?} */ (this);
if (that.isDisposed()) {
return fn.apply(self, arguments);
}
if (tracers) {
var tracer = goog.debug.Trace.startTracer(
'protectedEntryPoint: ' + that.getStackTraceHolder_(stackTrace));
}
try {
return fn.apply(self, arguments);
} catch (e) {
// Don't re-report errors that have already been handled by this code.
var MESSAGE_PREFIX =
goog.debug.ErrorHandler.ProtectedFunctionError.MESSAGE_PREFIX;
if ((e && typeof e === 'object' && e.message &&
e.message.indexOf(MESSAGE_PREFIX) == 0) ||
(typeof e === 'string' && e.indexOf(MESSAGE_PREFIX) == 0)) {
return;
}
that.errorHandlerFn_(e);
if (!that.wrapErrors_) {
// Add the prefix to the existing message.
if (that.prefixErrorMessages_) {
if (typeof e === 'object' && e && 'message' in e) {
e.message = MESSAGE_PREFIX + e.message;
} else {
e = MESSAGE_PREFIX + e;
}
}
if (goog.DEBUG) {
// Work around for https://code.google.com/p/v8/issues/detail?id=2625
// and https://code.google.com/p/chromium/issues/detail?id=237059
// Custom errors and errors with custom stack traces show the wrong
// stack trace
// If it has a stack and Error.captureStackTrace is supported (only
// supported in V8 as of May 2013) log the stack to the console.
if (e && e.stack && Error.captureStackTrace &&
goog.global['console']) {
goog.global['console']['error'](e.message, e.stack);
}
}
// Re-throw original error. This is great for debugging as it makes
// browser JS dev consoles show the correct error and stack trace.
throw e;
}
// Re-throw it since this may be expected by the caller.
throw new goog.debug.ErrorHandler.ProtectedFunctionError(e);
} finally {
if (tracers) {
goog.debug.Trace.stopTracer(tracer);
}
}
};