Refactor exception usage

This commit is contained in:
Jonas Lochmann
2020-09-28 02:00:00 +02:00
parent d68b425e0e
commit 8d65c5d777
148 changed files with 2061 additions and 769 deletions
+3 -1
View File
@@ -29,7 +29,7 @@ function parseYesNo (value: string) {
} else if (value === 'no') {
return false
} else {
throw new Error('invalid value "' + value + '", expected "yes" or "no"')
throw new ParseYesNoException('invalid value "' + value + '", expected "yes" or "no"')
}
}
@@ -39,3 +39,5 @@ export const config: Config = {
pingInterval: parseInt(process.env.PING_INTERVAL_SEC || '25', 10) * 1000,
alwaysPro: process.env.ALWAYS_PRO ? parseYesNo(process.env.ALWAYS_PRO) : false
}
class ParseYesNoException extends Error {}