diff --git a/src/app/core/dspace-rest/dspace-rest.service.ts b/src/app/core/dspace-rest/dspace-rest.service.ts index d949fff140..ea4e8c2831 100644 --- a/src/app/core/dspace-rest/dspace-rest.service.ts +++ b/src/app/core/dspace-rest/dspace-rest.service.ts @@ -112,11 +112,15 @@ export class DspaceRestService { statusText: res.statusText })), catchError((err) => { - return observableThrowError({ - statusCode: err.status, - statusText: err.statusText, - message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message - }); + if (hasValue(err.status)) { + return observableThrowError({ + statusCode: err.status, + statusText: err.statusText, + message: (hasValue(err.error) && isNotEmpty(err.error.message)) ? err.error.message : err.message + }); + } else { + return observableThrowError(err); + } })); } diff --git a/src/app/core/log/log.interceptor.ts b/src/app/core/log/log.interceptor.ts index 773a60b6ef..bf843f1da8 100644 --- a/src/app/core/log/log.interceptor.ts +++ b/src/app/core/log/log.interceptor.ts @@ -5,6 +5,7 @@ import { Router } from '@angular/router'; import { Observable } from 'rxjs'; import { CookieService } from '../services/cookie.service'; +import { hasValue } from '../../shared/empty.util'; /** * Log Interceptor intercepting Http Requests & Responses to @@ -23,7 +24,9 @@ export class LogInterceptor implements HttpInterceptor { // Add headers from the intercepted request let headers = request.headers; - headers = headers.append('X-CORRELATION-ID', correlationId); + if (hasValue(correlationId)) { + headers = headers.append('X-CORRELATION-ID', correlationId); + } headers = headers.append('X-REFERRER', this.router.url); // Add new headers to the intercepted request