From 4f530e5bc67e5200e76135a5954c84d7045ae695 Mon Sep 17 00:00:00 2001 From: reality Date: Tue, 22 Jan 2013 23:27:02 +0000 Subject: [PATCH] fix db meltage. [#191] --- modules/web/web.js | 11 +++++++++++ run.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/web/web.js b/modules/web/web.js index 04823d3..6ec409e 100644 --- a/modules/web/web.js +++ b/modules/web/web.js @@ -12,6 +12,17 @@ var webInterface = function(dbot) { app.get('/', function(req, res) { res.render('index', { 'name': dbot.config.name }); }); + + console.log(Object.keys(app)); + + app.configure(function(){ + app.use(function(err, req, res, next) { + console.log('Web encountered an error: ' + err); + }); + }); + app.on('error', function(err) { + console.log('Web encountered an error: ' + err); + }); var server = app.listen(dbot.config.web.webPort); diff --git a/run.js b/run.js index b2c8b81..e63ccc7 100644 --- a/run.js +++ b/run.js @@ -104,7 +104,7 @@ DBot.prototype.t = function(string, formatData) { // Save the database file DBot.prototype.save = function() { - fs.writeFile('db.json', JSON.stringify(this.db, null, ' ')); + fs.writeFileSync('db.json', JSON.stringify(this.db, null, ' ')); }; // Hot-reload module files.