summaryrefslogtreecommitdiffstats
path: root/lib/sendgrid.js
diff options
context:
space:
mode:
authorscottmotte <scott@scottmotte.com>2013-10-30 12:13:58 -0700
committerscottmotte <scott@scottmotte.com>2013-10-30 12:13:58 -0700
commit4287350e957f7ab30e6fd753e976ca0c87bbeaf7 (patch)
treec0254caddd10e883a5098d020a88d591a3c73138 /lib/sendgrid.js
parent01cf0d103998ae0a70d2086c6b13eece329dcc5f (diff)
downloadsendgrid-nodejs-4287350e957f7ab30e6fd753e976ca0c87bbeaf7.zip
sendgrid-nodejs-4287350e957f7ab30e6fd753e976ca0c87bbeaf7.tar.gz
sendgrid-nodejs-4287350e957f7ab30e6fd753e976ca0c87bbeaf7.tar.bz2
Give a more detailed try/catch. return the original body
Diffstat (limited to 'lib/sendgrid.js')
-rw-r--r--lib/sendgrid.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sendgrid.js b/lib/sendgrid.js
index 9a5ea60..637b6a2 100644
--- a/lib/sendgrid.js
+++ b/lib/sendgrid.js
@@ -91,6 +91,8 @@ var Sendgrid = function(api_user, api_key, options) {
try {
json = JSON.parse(body);
} catch (e) {
+ // be more granular with the error message
+ e.message = e.message + " JSONPARSEERROR when parsing: " + body;
return callback(new Error(e), null);
}