From 22c9a5e011301ea4ebc96c845ae8800bf146e056 Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 15 Mar 2015 18:46:58 +0000 Subject: [PATCH] extract err --- modules/api/api.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/api/api.js b/modules/api/api.js index 88ed709..ca6306c 100644 --- a/modules/api/api.js +++ b/modules/api/api.js @@ -51,6 +51,9 @@ var api = function(dbot) { if(callbackIndex != -1) { args[callbackIndex] = function() { body.data = Array.prototype.slice.call(arguments, 0); + if(_.isObject(body.data) && _.has(body.data, 'err')) { + body.err = body.data.err; + } res.json(body); }; func.apply(null, args);