aboutsummaryrefslogtreecommitdiff
path: root/update.js
diff options
context:
space:
mode:
authorJoel Kronqvist <joelkronqvist@proton.me>2023-06-26 17:22:32 +0000
committerJoel Kronqvist <joelkronqvist@proton.me>2023-06-26 17:22:32 +0000
commit330012395587fe87ce36c29b3c5d1941aa022d0b (patch)
tree7018bc2250937b5ed724d0b37e55d992a4d3d986 /update.js
parent7f59612f4ad1061c99ae53ef92baf04511b7f9af (diff)
downloadLYLLRuoka-330012395587fe87ce36c29b3c5d1941aa022d0b.tar.gz
LYLLRuoka-330012395587fe87ce36c29b3c5d1941aa022d0b.zip
Bug fixes & clearer presentation of errors to end userHEADmasterdevel
Diffstat (limited to 'update.js')
-rw-r--r--update.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/update.js b/update.js
index 919fede..ceedac6 100644
--- a/update.js
+++ b/update.js
@@ -14,9 +14,21 @@ async function buildDB(dbconnection, shiftPath, classPath, exceptionPath) {
let classes = await openFile(classPath);
classes = classes.toString('utf-8');
- await parseClasses(dbconnection, classes);
- await parse.build(shiftCont, dbconnection);
- await updateExceptions(exceptions, dbconnection);
+ try {
+ await parseClasses(dbconnection, classes);
+ } catch (e) {
+ throw new Error(`Virhe kurssitarjottimen osassa: ${e.message}`, { cause: e });
+ }
+ try {
+ await parse.build(shiftCont, dbconnection);
+ } catch (e) {
+ throw new Error(`Virhe ruokailuvuoroissa: ${e.message}`, { cause: e });
+ }
+ try {
+ await updateExceptions(exceptions, dbconnection);
+ } catch (e) {
+ throw new Error(`Virhe ilmoituksissa: ${e.message}`, { cause: e });
+ }
return 0;
}