after reading the documentation on angular about http client error handling, I still don\'t understand why I don\'t catch a 401 error from the server with the code below:
You must pass the argument value to the do function of the stream, not create a new function inside it:
return next.handle(request) .do((err: any) => { console.log('this log isn't'); if (err instanceof HttpErrorResponse) { if (err.status === 401) { console.log('nor this one!'); } } });