diff --git a/src/services/fhir/__tests__/sds-fhir-client.test.js b/src/services/fhir/__tests__/sds-fhir-client.test.js index 382c1a6b..9c568da8 100644 --- a/src/services/fhir/__tests__/sds-fhir-client.test.js +++ b/src/services/fhir/__tests__/sds-fhir-client.test.js @@ -110,8 +110,7 @@ describe('sds-fhir-client', () => { await expect(getPracticeAsid(odsCode, serviceId)).rejects.toThrow(errorMessage); expect(scope.isDone()).toBe(true); expect(logError).toHaveBeenCalledWith( - `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode}`, - errorMessage + `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode} - error: ${errorMessage.message}` ); }); @@ -132,8 +131,7 @@ describe('sds-fhir-client', () => { await expect(getPracticeAsid(odsCode, serviceId)).rejects.toThrow(errorMessage); expect(scope.isDone()).toBe(true); expect(logError).toHaveBeenCalledWith( - `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode}`, - errorMessage + `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode} - error: ${errorMessage.message}` ); }); @@ -154,8 +152,7 @@ describe('sds-fhir-client', () => { await expect(getPracticeAsid(odsCode, serviceId)).rejects.toThrow(errorMessage); expect(scope.isDone()).toBe(true); expect(logError).toHaveBeenCalledWith( - `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode}`, - errorMessage + `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode} - error: ${errorMessage.message}` ); }); @@ -176,8 +173,7 @@ describe('sds-fhir-client', () => { await expect(getPracticeAsid(odsCode, serviceId)).rejects.toThrow(errorMessage); expect(scope.isDone()).toBe(true); expect(logError).toHaveBeenCalledWith( - `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode}`, - errorMessage + `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode} - error: ${errorMessage.message}` ); }); @@ -198,8 +194,7 @@ describe('sds-fhir-client', () => { await expect(getPracticeAsid(odsCode, serviceId)).rejects.toThrow(errorMessage); expect(scope.isDone()).toBe(true); expect(logError).toHaveBeenCalledWith( - `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode}`, - errorMessage + `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode} - error: ${errorMessage.message}` ); }); }); diff --git a/src/services/fhir/sds-fhir-client.js b/src/services/fhir/sds-fhir-client.js index 5ea2f25e..a3999cf8 100644 --- a/src/services/fhir/sds-fhir-client.js +++ b/src/services/fhir/sds-fhir-client.js @@ -43,9 +43,11 @@ export const getPracticeAsid = async (odsCode, serviceId) => { logInfo(`Successfully retrieved ASID: ${asidCode} via FHIR for ODS code ${odsCode}`); return asidCode; } catch (err) { - logError(`Failed to retrieve ASID from FHIR for ODS Code: ${odsCode}`); - logError(`Error details: ${err.message ? err.message : 'No Error Message'}`); - + logError( + `Failed to retrieve ASID from FHIR for ODS Code: ${odsCode} - error: ${ + err.message ? err.message : 'No Error Message' + }` + ); if (err.response) { logError( `Error: Request failed with non-2xx status code\n