From c8443257eacfb746c2bfffee5d7dd95b55b2eee7 Mon Sep 17 00:00:00 2001 From: Elias Keis <13063245+elKei24@users.noreply.github.com> Date: Mon, 25 May 2020 13:10:52 +0200 Subject: [PATCH] no empty error messages --- src/common/api/apiError.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/api/apiError.js b/src/common/api/apiError.js index 3b3a11f..f4e7f02 100644 --- a/src/common/api/apiError.js +++ b/src/common/api/apiError.js @@ -17,7 +17,8 @@ export default class ApiError extends Error { constructor (response: Response, errorDetails?: ApiErrorDetails) { super((errorDetails && !isEmpty(errorDetails.message) && errorDetails.message !== 'No message available') ? errorDetails.message - : response.statusText) + : response?.statusText || + response?.status ? `API responded with error ${response.status}` : 'API error') this.response = response this.errorDetails = errorDetails }