Commit 0068b7cc003aaab6f75a15f7e09f7e456a52e7eb
better error handling
ansuz committed on 10/31/2016, 4:53:57 PMParent: b357b56dacd821a496aeddf0de4a7b1713bc34a9
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -6,10 +6,14 @@ | |||
6 | 6 … | var Config; | |
7 | 7 … | try { | |
8 | 8 … | Config = require("./config.js"); | |
9 | 9 … | } catch (err) { | |
10 | - console.error("\nCouldn't find './config.js'. Using defaults"); | ||
11 | - Config = require("./config.dist.js"); | ||
10 … | + if (err.code === 'MODULE_NOT_FOUND') { | ||
11 … | + console.error("\nCouldn't find './config.js'. Using defaults"); | ||
12 … | + Config = require("./config.dist.js"); | ||
13 … | + } else { | ||
14 … | + throw err; | ||
15 … | + } | ||
12 | 16 … | } | |
13 | 17 … | ||
14 | 18 … | var log = { | |
15 | 19 … | req: function (req) { |
Built with git-ssb-web