-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Effect error logging should be customizable or use ErrorHandler #626
Comments
Related question: Is it possible to override |
Not while |
Exposing the |
I can do it. However I do question what the point of |
How should this be exposed?
I'd would vote for 2 because it's mainly just deleting stuff, and I think that's what 99% of people would want... errors logged to the angular-standard Note that all of these make the error-information public. |
I vote for option 1 as its not a breaking change. If you want to override the |
How about also changing |
Sounds good to me |
Fixes ngrx#626 BREAKING CHANGE: Errors are now reported to the @angular/core Errorhandler. Errors are no longer reported to the console.
Fixes ngrx#626 BREAKING CHANGE: Errors are now reported to the @angular/core ErrorHandler. Errors are no longer reported to the console.
Fixes ngrx#626 BREAKING CHANGE: Errors are now reported to the @angular/core ErrorHandler. Errors are no longer reported to the console.
Fixes ngrx#626 BREAKING CHANGE: Errors are now reported to the @angular/core ErrorHandler. Errors are no longer reported to the console.
Fixes ngrx#626 BREAKING CHANGE: Errors are now reported to the @angular/core ErrorHandler. Errors are no longer reported to the console.
Fixes ngrx#626 BREAKING CHANGE: Errors are now reported to the @angular/core ErrorHandler. Errors are no longer reported to the console.
Fixes ngrx#626 BREAKING CHANGE: BEFORE: Errors were reported to the ngrx/effects `ErrorReporter`. The `ErrorReporter` would log to the console by default. AFTER: Errors are now reported to the @angular/core `ErrorHandler`.
Fixes ngrx#626 BREAKING CHANGE: the ErrorReporter has been replaced with ErrorHandler from angular/core. BEFORE: Errors were reported to the ngrx/effects ErrorReporter. The ErrorReporter would log to the console by default. AFTER: Errors are now reported to the @angular/core ErrorHandler.
I have implemented a global error handler globally and for whatever reason my ngrx-effects are not picking it up. The error handler works for everything except ngrx effects. My code looks like this:
then i have:
|
@amcdnl I am facing the same problem. Did you figure this out? |
@mohyeid the global error handler cannot be used with effects in that way. If your Observable stream errors, the stream will end. This is not an issue but how RxJS works. Correct usage is to handle your errors explicitly in your effect streams and return a new inner Observable. Example @Effect() someEffect = this.actions$.pipe(
ofType(SomeAction)
mergeMap(() =>
doSomething().pipe(
map(() => NewAction),
catchError(() => EmptyObservable)
)
) |
@brandonroberts Thanks for your response. I am trying to handle general error and actually I just got a working example on stackblitz: |
@mohyeid - I did a follow up post on this - https://medium.com/@amcdnl/handling-errors-in-ngrx-effects-2a116640d6bb ... might interest you. |
Thanks all. I found the root of my problem. I am sending the error object as my payload to the effect and the dev tools is trying to strengify the error to send it as a state change using window.postmessage. This will fail with "Converting circular structure to JSON" error. I will create my own error model and copy the items I am interested in to fix this. If I disabled the dev tools, everything will work as expected. |
I'm submitting a...
What is the current behavior?
Errors are sent to the internal
ErrorReporter
which logs to the consoleExpected behavior:
Errors should be logged to
ErrorHandler
(from@angular/core
) orErrorReporter
should be public and customizable/overridable to allow doing so (or both).Version of affected browser(s),operating system(s), npm, node and ngrx:
4+ ?
Other information:
Personally I'd think just sending all errors to
ErrorHandler
would be best and theErrorReporter
can be removed, but maybe others depend on the console logging fromErrorReporter
? Maybe just makingErrorReporter
public/overridable is a good start without any breaking changes?The text was updated successfully, but these errors were encountered: