Skip to content

A local-first personal finance app

Fix crash when SimpleFIN JSON data is bad. (#409)

Robert Dyerd33e5cc76631
diff --git a/src/app-simplefin/app-simplefin.js b/src/app-simplefin/app-simplefin.js
index 526e8ae09d..5d8693ebf4 100644
--- a/src/app-simplefin/app-simplefin.js
+++ b/src/app-simplefin/app-simplefin.js
@@ -281,7 +281,12 @@ async function getAccounts(accessKey, startDate, endDate) {
data += d;
});
res.on('end', () => {
- resolve(JSON.parse(data));
+ try {
+ resolve(JSON.parse(data));
+ } catch (e) {
+ console.log(`Error parsing JSON response: ${data}`);
+ reject(e);
+ }
});
},
);
diff --git a/upcoming-release-notes/409.md b/upcoming-release-notes/409.md
new file mode 100644
index 0000000000..933f9cfc00
--- /dev/null
+++ b/upcoming-release-notes/409.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [psybers,iffy]
+---
+
+Fix crash when SimpleFIN JSON data is bad.