Created
August 24, 2023 19:27
-
-
Save jnizet/dea9dca3f21068550c7db4575f5a6f95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Don't do | |
return next(req).pipe( | |
catchError(error => { | |
const status = error.status; | |
if (status === HttpStatusCode.BadRequest) { | |
// ... | |
} else { | |
... | |
} | |
throwError(() => error); | |
}) | |
)) | |
// Rather do | |
return next(req).pipe( | |
tap({ | |
error: error => { | |
const status = error.status; | |
if (status === HttpStatusCode.BadRequest) { | |
// ... | |
} else { | |
... | |
} | |
} | |
}) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment