mirror of
https://github.com/Sea-Haven-Industries/payments-dashboard.git
synced 2026-09-30 04:13:12 +00:00
Improve BoA API error logging and update .gitignore
Read response as text before JSON parsing to capture non-JSON error responses from BoA API. Add .DS_Store, BofA API Resources, and CSV files to .gitignore.
This commit is contained in:
parent
ffd46c4bda
commit
c849280705
2 changed files with 7 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -2,3 +2,6 @@ node_modules/
|
|||
.aws-sam/
|
||||
samconfig.toml
|
||||
data/
|
||||
.DS_Store
|
||||
BofA API Resources/
|
||||
*.csv
|
||||
|
|
|
|||
|
|
@ -223,13 +223,15 @@ export const handler = async (event) => {
|
|||
}
|
||||
);
|
||||
|
||||
const data = await res.json();
|
||||
const text = await res.text();
|
||||
|
||||
if (!res.ok) {
|
||||
console.error(`BoA ${action} error ${res.status}:`, JSON.stringify(data));
|
||||
console.error(`BoA ${action} error ${res.status}:`, text);
|
||||
throw new Error(`BoA ${action} failed: ${res.status}`);
|
||||
}
|
||||
|
||||
const data = JSON.parse(text);
|
||||
|
||||
console.log(
|
||||
`BoA ${action}: ${data.processedItems}/${data.totalItems} processed, ${data.unprocessedItems} failed`
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue