We have multiple engineering groups working independently building Angular modules (NgModules). We keep these modules entirely independent and self-sufficient and, as such, have their own ErrorHandler overrides. The modules are route lazy loaded as needed into parent apps that require their functionality. Note, although not relevant, the modules are federated (see webpack) and are lazy loaded from other machines. But, for now, we don't believe their federation is the root cause of the issue.
The ErrorHandlers work fine and catch insider/client 'Error's when running in their own standalone apps. However, when loaded into the parent app which DOES NOT OVERRIDE their ErrorHandler's service, the insider Errors are not caught. Important NOTE: The HTTPResponse/HttpErrorResponse, errors (ie outsider/server errors) ARE caught since each independent module calls their overridden ErrorHandler actively via the standard interceptor model-unike the insider/client errors that are called by Angular.
However, when we add an ErrorHandler to the parent, the insider/client Error exceptions do start getting called. Which subverts the modularity required and separation of concerns of our modules. Note, it seems the ErrorHandler must provided at 'root' of any app that requires this feature. Submodules that have that feature are not invoked (except for outsider/server errors).
It 'seems the ErrorHandl
I think that this issue steams from the assumptions that are not corresponding to the Angular's DI design and implementation:
ErrorHandler) are not scoped to
NgModule- instead those are merged / overriden;
ErrorHandlerin the entire Angular application. We do not intend to support per-NgModule error handlers / more than one ErrorHandler per application.
Closing as not something we intend to support.
@pkozlowski-opensource Many thanks. Seems there are architectural obstacles that prohibit this. What is the root rationale ErrorHandler is not provided at module level but at app root once? Can you provide thoughts so we can internally close this thinking and not attempt to write our own?
|Issue Title||Created Date||Updated Date|