As you know it\'s possible to use Interceptors in new versions of Angular 4.
In mine, I want to cancel a request in interceptor in some conditions. So i
As suggested above, there is more optimal way to handle the error with custom response
import { throwError, Observable } from 'rxjs';
import { HttpEvent } from '@angular/common/http';
intercept(request: HttpRequest, next: HttpHandler): Observable> {
if (authFailedDummy(request)) {
return throwError(new Error('Authorization error: The request did not go through'));
}
return next.handle(request);
}