Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CSAN
Csan
Commits
d5322c3d
Unverified
Commit
d5322c3d
authored
Sep 28, 2020
by
Will Sun
Committed by
GitHub
Sep 28, 2020
Browse files
Merge pull request #13175 from AllForNothing/504
Handle 504 error from backend
parents
fc5743b3
e999a15b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
src/portal/src/app/services/intercept-http.service.ts
src/portal/src/app/services/intercept-http.service.ts
+9
-1
No files found.
src/portal/src/app/services/intercept-http.service.ts
View file @
d5322c3d
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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment