summaryrefslogtreecommitdiffstats
path: root/lib/sendgrid.js
diff options
context:
space:
mode:
authorRoman Shtylman <shtylman@gmail.com>2013-07-31 13:30:53 -0700
committerRoman Shtylman <shtylman@gmail.com>2013-07-31 13:30:53 -0700
commite5fe70389aba0b7b8721bb3c52af461c11588eb9 (patch)
treeeff21ef5add02f1179b9753f3482ed16bb46ad2c /lib/sendgrid.js
parent49dfd07d4ff93c168c9c3f44e15008f61cfb26dc (diff)
downloadsendgrid-nodejs-e5fe70389aba0b7b8721bb3c52af461c11588eb9.zip
sendgrid-nodejs-e5fe70389aba0b7b8721bb3c52af461c11588eb9.tar.gz
sendgrid-nodejs-e5fe70389aba0b7b8721bb3c52af461c11588eb9.tar.bz2
use error object for 'err' callback param
Error object contain stacktraces and additional information that helps debug potential issues. They are expected as the first argument versus just a string.
Diffstat (limited to 'lib/sendgrid.js')
-rw-r--r--lib/sendgrid.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js
index be04e96..ebda0cd 100644
--- a/lib/sendgrid.js
+++ b/lib/sendgrid.js
@@ -67,11 +67,11 @@ module.exports = function(api_user, api_key) {
if (json.message !== 'success') {
var error = 'sendgrid error';
if (json.errors) { error = json.errors.shift(); }
- return callback(error, null);
+ return callback(new Error(error), null);
}
return callback(null, json);
- });
+ });
var form = email.toWebFormat();
form['api_user'] = api_user;