message: allow return of data when pdf fails to download
diff: @@ -252,6 +252,7 @@ export class EmissionsContractInvoke {
  const jsonResult: any = JSON.parse(stringResult);
  if (jsonResult.url.length > 0) {
  + try {
  // compare md5 in ledger against one being returned in url
  let incomingBinary: any = await downloadFromS3(
  `${userId}-${orgName}-${jsonResult.utilityId}-${jsonResult.partyId}-${jsonResult.fromDate}-${jsonResult.thruDate}.pdf`
  @@ -262,6 +263,9 @@ export class EmissionsContractInvoke {
  `The retrieved document ${jsonResult.url} has a different MD5 hash than recorded on the ledger. This file may have been tampered with. `
  );
  }
  + } catch (err) {
  + console.log("Failed to download from URL");
  + }
  }
  // Disconnect from the gateway.
  @@ -339,16 +343,20 @@ export class EmissionsContractInvoke {
  let result: Object = new Object();
  let record = emission_item.Record;
  if (record.url.length > 0) {
  + try {
  // compare md5 in ledger against one being returned in url
  - let incomingBinary = await downloadFromS3(
  - `${userId}-${orgName}-${record.utilityId}-${record.partyId}-${record.fromDate}-${record.thruDate}.pdf`
  + let incomingBinary: any = await downloadFromS3(
  + `${userId}-${orgName}-${jsonResult.utilityId}-${jsonResult.partyId}-${jsonResult.fromDate}-${jsonResult.thruDate}.pdf`
  );
  let incomingMd5 = Md5.hashStr(incomingBinary);
  - if (incomingMd5 != record.md5) {
  + if (incomingMd5 != jsonResult.md5) {
  throw new Error(
  - `The retrieved document ${record.url} has a different MD5 hash than recorded on the ledger. This file may have been tampered with. `
  + `The retrieved document ${jsonResult.url} has a different MD5 hash than recorded on the ledger. This file may have been tampered with. `
  );
  }
  + } catch (err) {
  + console.log("Failed to download from URL");
  + }
  }
  // Do not include entries outside of the past year
  @@ -433,16 +441,20 @@ export class EmissionsContractInvoke {
  let result: Object = new Object();
  let record = emission_item.Record;
  if (record.url.length > 0) {
  + try {
  // compare md5 in ledger against one being returned in url
  - let incomingBinary = await downloadFromS3(
  - `${userId}-${orgName}-${record.utilityId}-${record.partyId}-${record.fromDate}-${record.thruDate}.pdf`
  + let incomingBinary: any = await downloadFromS3(
  + `${userId}-${orgName}-${jsonResult.utilityId}-${jsonResult.partyId}-${jsonResult.fromDate}-${jsonResult.thruDate}.pdf`
  );
  let incomingMd5 = Md5.hashStr(incomingBinary);
  - if (incomingMd5 != record.md5) {
  + if (incomingMd5 != jsonResult.md5) {
  throw new Error(
  - `The retrieved document ${record.url} has a different MD5 hash than recorded on the ledger. This file may have been tampered with. `
  + `The retrieved document ${jsonResult.url} has a different MD5 hash than recorded on the ledger. This file may have been tampered with. `
  );
  }
  + } catch (err) {
  + console.log("Failed to download from URL");
  + }
  }
  result["info"] = "UTILITY EMISSIONS DATA";
  result["uuid"] = record.uuid;
  