From 3f01a75389314013078f57a7b634c97a2f3ad44f Mon Sep 17 00:00:00 2001 From: jasquat Date: Fri, 19 Aug 2022 10:50:21 -0400 Subject: [PATCH] print standard message if one cannot be found in the result w/ burnettk cullerton --- src/services/HttpService.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/services/HttpService.ts b/src/services/HttpService.ts index f466ae5..0acde11 100644 --- a/src/services/HttpService.ts +++ b/src/services/HttpService.ts @@ -79,10 +79,16 @@ const makeCallToBackend = ({ .then((result: any) => { if (isSuccessful) { successCallback(result); - } else if (failureCallback) { - failureCallback(result.message); } else { - console.log(result.message); + let message = 'A server error occurred.'; + if (result.message) { + message = result.message; + } + if (failureCallback) { + failureCallback(message); + } else { + console.log(message); + } } }) .catch((error) => {