feat(core): provide an error context when an exception happens in an error handler

This commit is contained in:
vsavkin
2015-07-27 15:47:42 -07:00
parent 1d4502944c
commit 8543c347a8
13 changed files with 175 additions and 67 deletions
@@ -80,6 +80,13 @@ void tick([int millis = 0]) {
_fakeAsync.elapse(duration);
}
/**
* This is not needed in Dart. Because quiver correctly removes a timer when
* it throws an exception.
*/
void clearPendingTimers() {
}
/**
* Flush any pending microtasks.
*/
+9 -3
View File
@@ -41,9 +41,7 @@ export function fakeAsync(fn: Function): Function {
return function(...args) {
// TODO(tbosch): This class should already be part of the jasmine typings but it is not...
_scheduler = new (<any>jasmine).DelayedFunctionScheduler();
ListWrapper.clear(_microtasks);
ListWrapper.clear(_pendingPeriodicTimers);
ListWrapper.clear(_pendingTimers);
clearPendingTimers();
let res = fakeAsyncZone.run(() => {
let res = fn(...args);
@@ -67,6 +65,14 @@ export function fakeAsync(fn: Function): Function {
}
}
// TODO we should fix tick to dequeue the failed timer instead of relying on clearPendingTimers
export function clearPendingTimers() {
ListWrapper.clear(_microtasks);
ListWrapper.clear(_pendingPeriodicTimers);
ListWrapper.clear(_pendingTimers);
}
/**
* Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
*
@@ -32,6 +32,7 @@ export interface NgMatchers extends jasmine.Matchers {
export var expect: (actual: any) => NgMatchers = <any>_global.expect;
// TODO vsavkin: remove it and use lang/isDart instead
export var IS_DARTIUM = false;
export class AsyncTestCompleter {