diff --git a/healthcare/fhir/deleteFhirResource.js b/healthcare/fhir/deleteFhirResource.js index 49a432aab2..52016b5df8 100644 --- a/healthcare/fhir/deleteFhirResource.js +++ b/healthcare/fhir/deleteFhirResource.js @@ -29,6 +29,7 @@ const main = ( auth: new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }), + responseType: 'json', }); const deleteFhirResource = async () => { @@ -46,10 +47,14 @@ const main = ( // fails, the server returns a 200 OK HTTP status code. To check that the // resource was successfully deleted, search for or get the resource and // see if it exists. - await healthcare.projects.locations.datasets.fhirStores.fhir.delete( - request - ); - console.log('Deleted FHIR resource'); + try { + await healthcare.projects.locations.datasets.fhirStores.fhir.delete( + request + ); + console.log(`Deleted FHIR resource: ${resourceId}`); + } catch (error) { + console.error('Error deleting FHIR resource:', error.message || error); + } }; deleteFhirResource(); diff --git a/healthcare/fhir/system-test/fhir_resources.test.js b/healthcare/fhir/system-test/fhir_resources.test.js index 61c09595fa..17769ff97b 100644 --- a/healthcare/fhir/system-test/fhir_resources.test.js +++ b/healthcare/fhir/system-test/fhir_resources.test.js @@ -181,7 +181,10 @@ it('should delete a FHIR resource', () => { `node deleteFhirResource.js ${projectId} ${cloudRegion} ${datasetId} ${fhirStoreId} ${resourceType} ${resourceId}`, {cwd} ); - assert.strictEqual(new RegExp('Deleted FHIR resource').test(output), true); + assert.strictEqual( + new RegExp(`Deleted FHIR resource: ${resourceId}`).test(output), + true + ); // Clean up execSync(