fix(exception_handler): log errors via console.error
This is e.g. needed as we use this to test for errors in our examples.
This commit is contained in:
2
modules/angular2/src/core/application.js
vendored
2
modules/angular2/src/core/application.js
vendored
@ -134,7 +134,7 @@ function _injectorBindings(appComponentType): List<Binding> {
|
||||
function _createVmZone(givenReporter:Function): VmTurnZone {
|
||||
var defaultErrorReporter = (exception, stackTrace) => {
|
||||
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
|
||||
print(`${exception}\n\n${longStackTrace}`);
|
||||
DOM.logError(`${exception}\n\n${longStackTrace}`);
|
||||
throw exception;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import {Injectable} from 'angular2/di';
|
||||
import {isPresent, print} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper, isListLikeIterable} from 'angular2/src/facade/collection';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
/**
|
||||
* Provides a hook for centralized exception handling.
|
||||
@ -36,6 +37,6 @@ export class ExceptionHandler {
|
||||
call(error, stackTrace = null, reason = null) {
|
||||
var longStackTrace = isListLikeIterable(stackTrace) ? ListWrapper.join(stackTrace, "\n\n") : stackTrace;
|
||||
var reasonStr = isPresent(reason) ? `\n${reason}` : '';
|
||||
print(`${error}${reasonStr}\nSTACKTRACE:\n${longStackTrace}`);
|
||||
DOM.logError(`${error}${reasonStr}\nSTACKTRACE:\n${longStackTrace}`);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user