I am trying to build an application in angular but i'm running into a problem when my application is unable to catch an exception thrown inside zone.js (version ^0.8.26).
I'm relatively new to angular but my objective is to have my custom ErrorHandler to catch all exceptions that was not handled inside my components and services. But for some reason the exception was not reaching my ErrorHandler. According to my browser's console the exception is being thrown inside zone.js (line 192), below is the snippet from that file
try {
if (task.type == macroTask && task.data && !task.data.isPeriodic) {
task.cancelFn = null;
}
try {
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
}
catch (error) {
if (this._zoneDelegate.handleError(this, error)) {
throw error;
}
}
}
The HTTP request that was invoking the error is from an observable. Could this mean that the exception is being raised outside my angular app? Below is the flow of my code.
this.xyz.getResult().subscribe(result=> {
this.callAction(result); //this is expected to throw an HttpErrorResponse, but the exception that was raised from zone.js does not reach my ErrorHandler
});