usdigitalresponse / usdr-gost

USDR-hosted grants management tools
http://grants.usdigitalresponse.org
Apache License 2.0
29 stars 20 forks source link

Add informative error logging to debug Treasury report failures #2525

Open as1729 opened 7 months ago

as1729 commented 7 months ago

Why is this issue important?

When treasury reports fail there is not much contextual information added to the logs to easily identify:

  1. Which files or source-data is causing the issue?
  2. Which users are impacted?

Current State

When an error occurs in the arpa treasury report generation we see generic information of the stack trace and system-generated error message as seen by this trace. For example:

Error: Unsupported ZIP Compression method NaN
    at parse_local_file (/app/node_modules/xlsx/xlsx.js:2688:18)
    at parse_zip (/app/node_modules/xlsx/xlsx.js:2649:3)
    at parse (/app/node_modules/xlsx/xlsx.js:1485:47)
    at Object.read (/app/node_modules/xlsx/xlsx.js:1817:9)
    at zip_read (/app/node_modules/xlsx/xlsx.js:3434:43)
    at read_zip (/app/node_modules/xlsx/xlsx.js:23643:8)
    at readSync (/app/node_modules/xlsx/xlsx.js:23715:69)
    at Object.readFileSync (/app/node_modules/xlsx/xlsx.js:23738:9)
    at loadTemplate (/app/src/arpa_reporter/services/get-template.js:49:27)
    at getTemplate (/app/src/arpa_reporter/services/get-template.js:62:28)

Expected State

When an error occurs in the arpa treasury report generation we see:

  1. Stack trace (which already exists today)
  2. Input-data (filename) that caused the error to occur (or filename that caused the issue)

For Example:

Error: Unsupported ZIP Compression method NaN. Please review contents of filename: "projectBulkUpload.csv"

Note: this additional information should only be logged in case of an error. We do not need logging for every single upload/file that is being iterated on for aggregation.

Implementation Plan

The following functions need to be added...

Relevant Code Snippets

No response

jasonzhang4628 commented 7 months ago

taking this on!