Commit e999a15b authored by AllForNothing's avatar AllForNothing
Browse files

Handle 504 error from backend


Signed-off-by: default avatarAllForNothing <sshijun@vmware.com>
parent b2a53a7e
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpResponse } from '@angular/common/http';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { catchError, tap } from 'rxjs/operators';
......@@ -44,6 +44,14 @@ export class InterceptHttpService implements HttpInterceptor {
}))
.pipe(
catchError(error => {
// handle 504 error in document format from backend
if (error && error.status === 504) {
// throw 504 error in json format
return throwError(new HttpErrorResponse({
error: '504 gateway timeout',
status: 504
}));
}
if (error.status === 403) {
const csrfToken = localStorage.getItem("__csrf");
if (csrfToken) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment