From 330012395587fe87ce36c29b3c5d1941aa022d0b Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Mon, 26 Jun 2023 17:22:32 +0000 Subject: Bug fixes & clearer presentation of errors to end user --- update.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'update.js') 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; } -- cgit v1.2.3