diff --git a/healthcare/fhir/deleteFhirResourcePurge.js b/healthcare/fhir/deleteFhirResourcePurge.js index 16601b4f8b..cf1023aacb 100644 --- a/healthcare/fhir/deleteFhirResourcePurge.js +++ b/healthcare/fhir/deleteFhirResourcePurge.js @@ -29,6 +29,7 @@ const main = ( auth: new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }), + responseType: 'json', }); const deleteFhirResourcePurge = async () => { @@ -42,10 +43,14 @@ const main = ( const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}/fhir/${resourceType}/${resourceId}`; const request = {name}; - await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge( - request - ); - console.log('Deleted all historical versions of resource'); + try { + await healthcare.projects.locations.datasets.fhirStores.fhir.ResourcePurge( + request + ); + console.log(`Purged all historical versions of resource: ${resourceId}`); + } catch (error) { + console.error('Error purging FHIR resource:', error.message || error); + } }; deleteFhirResourcePurge(); diff --git a/healthcare/fhir/system-test/fhir_resources.test.js b/healthcare/fhir/system-test/fhir_resources.test.js index 61c09595fa..b7f2762bbd 100644 --- a/healthcare/fhir/system-test/fhir_resources.test.js +++ b/healthcare/fhir/system-test/fhir_resources.test.js @@ -163,7 +163,9 @@ it('should purge all historical versions of a FHIR resource', () => { {cwd} ); assert.strictEqual( - new RegExp('Deleted all historical versions of resource').test(output), + new RegExp( + `Purged all historical versions of resource: ${resourceId}` + ).test(output), true ); });