Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit eb9b3fa

Browse files
oodamienjvalkeal
authored andcommitted
Error handle: update parsing HTTP Error
Resolves #933
1 parent f377def commit eb9b3fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ui/src/app/shared/model/error-handler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Observable } from 'rxjs/Observable';
22
import { AppError, HttpAppError } from './error.model';
33
import { LoggerService } from '../services/logger.service';
4+
import { HttpErrorResponse } from '@angular/common/http';
45

56
export class ErrorHandler {
67

@@ -14,15 +15,14 @@ export class ErrorHandler {
1415
status: 0,
1516
message: ''
1617
};
17-
18-
if (error instanceof Response) {
18+
if (error instanceof HttpErrorResponse) {
1919
let body;
2020
errorObject.status = error.status;
2121
try {
22-
body = error.json() || '';
22+
body = error.error || '';
2323
} catch (e) {
2424
LoggerService.log('Unparsable json', error);
25-
errorObject.message = `${error.text()} (Status code: ${error.status})`;
25+
errorObject.message = `${error} (Status code: ${error.status})`;
2626
}
2727
if (body) {
2828
let isFirst = true;

0 commit comments

Comments
 (0)