From 38353b4c07fca4e425d4933e01e329c4ff53d567 Mon Sep 17 00:00:00 2001 From: Michael Morrison Date: Fri, 12 Jul 2013 05:39:08 -0500 Subject: [PATCH] "actually" add query and notes to errors. --- protocols/core.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/protocols/core.js b/protocols/core.js index 0ce05d0..c7c35a8 100644 --- a/protocols/core.js +++ b/protocols/core.js @@ -50,6 +50,12 @@ module.exports = Class.extend(EventEmitter,{ finish: function(state) { this.finalizeState(state); + this.done(state); + }, + + done: function(state) { + if(this.finished) return; + clearTimeout(this.globalTimeoutTimer); if(this.options.notes) state.notes = this.options.notes; @@ -60,17 +66,10 @@ module.exports = Class.extend(EventEmitter,{ state.query.type = this.type; if('pretty' in this) state.query.pretty = this.pretty; - this.done(state); - }, - - done: function(result) { - if(this.finished) return; - clearTimeout(this.globalTimeoutTimer); - this.reset(); this.finished = true; - this.emit('finished',result); - if(this.options.callback) this.options.callback(result); + this.emit('finished',state); + if(this.options.callback) this.options.callback(state); }, reset: function() {