From 639e6c452d2d896d37bd95ee6ecf3a81bbb72741 Mon Sep 17 00:00:00 2001 From: dreamdevil00 Date: Sat, 29 Sep 2018 15:44:48 +0800 Subject: [PATCH] fix: read property error of undefined when DOMException occured --- lib/angular2/shared/services/core/error.ejs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/angular2/shared/services/core/error.ejs b/lib/angular2/shared/services/core/error.ejs index 3dac5adf..45e85837 100644 --- a/lib/angular2/shared/services/core/error.ejs +++ b/lib/angular2/shared/services/core/error.ejs @@ -8,6 +8,8 @@ import { Observable, throwError } from 'rxjs'; @Injectable() export class ErrorHandler { public handleError(errorResponse: HttpErrorResponse): Observable { - return throwError(errorResponse.error.error || 'Server error'); + return throwError( + (errorResponse.error && errorResponse.error.error) || 'Server error', + ); } }