diff --git a/healthcare/fhir/listFhirResourceHistory.js b/healthcare/fhir/listFhirResourceHistory.js index acee5552e0..f71979d9f8 100644 --- a/healthcare/fhir/listFhirResourceHistory.js +++ b/healthcare/fhir/listFhirResourceHistory.js @@ -29,6 +29,7 @@ const main = ( auth: new google.auth.GoogleAuth({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }), + responseType: 'json', }); const listFhirResourceHistory = async () => { @@ -42,11 +43,18 @@ const main = ( const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/fhirStores/${fhirStoreId}/fhir/${resourceType}/${resourceId}/_history`; const request = {name}; - const resource = - await healthcare.projects.locations.datasets.fhirStores.fhir.read( - request + try { + const resource = + await healthcare.projects.locations.datasets.fhirStores.fhir.read( + request + ); + console.log(JSON.stringify(resource.data, null, 2)); + } catch (error) { + console.error( + 'Error listing FHIR resource history:', + error.message || error ); - console.log(JSON.stringify(resource.data, null, 2)); + } }; listFhirResourceHistory();