Skip to content

Instantly share code, notes, and snippets.

@jnizet
Created August 24, 2023 19:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnizet/dea9dca3f21068550c7db4575f5a6f95 to your computer and use it in GitHub Desktop.
Save jnizet/dea9dca3f21068550c7db4575f5a6f95 to your computer and use it in GitHub Desktop.
// 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