Skip to content

Commit 86c2a02

Browse files
committed
improve error handling on remote gift history
1 parent daf7623 commit 86c2a02

5 files changed

Lines changed: 40 additions & 13 deletions

File tree

dist/engrid.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* ENGRID PAGE TEMPLATE ASSETS
2121
*
22-
* Date: Monday, May 18, 2026 @ 04:18:17 ET
22+
* Date: Monday, May 18, 2026 @ 05:15:50 ET
2323
* By: michael
2424
* ENGrid styles: v0.25.0
2525
* ENGrid scripts: v0.25.1

dist/engrid.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* ENGRID PAGE TEMPLATE ASSETS
1919
*
20-
* Date: Monday, May 18, 2026 @ 04:18:17 ET
20+
* Date: Monday, May 18, 2026 @ 05:15:50 ET
2121
* By: michael
2222
* ENGrid styles: v0.25.0
2323
* ENGrid scripts: v0.25.1
@@ -28252,9 +28252,20 @@ class GiftHistory {
2825228252
return [];
2825328253
}
2825428254

28255-
const req = await fetch(`https://encrmgifthistapi.wwfus.org/api/supporter/${constituentId}?code=4ZoWptvxmdnaZEKLAS65bFH7ErI17TY0YeE305o2HDLnAzFugcpdAw==`);
28256-
this.remoteGiftHistoryFetched = true;
28257-
return await req.json();
28255+
try {
28256+
const req = await fetch(`https://encrmgifthistapi.wwfus.org/api/supporter/${constituentId}?code=4ZoWptvxmdnaZEKLAS65bFH7ErI17TY0YeE305o2HDLnAzFugcpdAw==`);
28257+
this.remoteGiftHistoryFetched = true;
28258+
28259+
if (!req.ok) {
28260+
this.logger.log(`Remote gift history request failed with status ${req.status}`);
28261+
return [];
28262+
}
28263+
28264+
return await req.json();
28265+
} catch (error) {
28266+
this.logger.log(`Error fetching remote gift history: ${error instanceof Error ? error.message : "Unknown error"}`);
28267+
return [];
28268+
}
2825828269
}
2825928270

2826028271
}

dist/engrid.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/engrid.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scripts/gift-history.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,26 @@ export default class GiftHistory {
372372
);
373373
return [];
374374
}
375-
const req = await fetch(
376-
`https://encrmgifthistapi.wwfus.org/api/supporter/${constituentId}?code=4ZoWptvxmdnaZEKLAS65bFH7ErI17TY0YeE305o2HDLnAzFugcpdAw==`
377-
);
378-
this.remoteGiftHistoryFetched = true;
379-
return await req.json();
375+
376+
try {
377+
const req = await fetch(
378+
`https://encrmgifthistapi.wwfus.org/api/supporter/${constituentId}?code=4ZoWptvxmdnaZEKLAS65bFH7ErI17TY0YeE305o2HDLnAzFugcpdAw==`
379+
);
380+
this.remoteGiftHistoryFetched = true;
381+
if (!req.ok) {
382+
this.logger.log(
383+
`Remote gift history request failed with status ${req.status}`
384+
);
385+
return [];
386+
}
387+
return await req.json();
388+
} catch (error) {
389+
this.logger.log(
390+
`Error fetching remote gift history: ${
391+
error instanceof Error ? error.message : "Unknown error"
392+
}`
393+
);
394+
return [];
395+
}
380396
}
381397
}

0 commit comments

Comments
 (0)