diff options
author | Adam Buczynski <adambuczynski@gmail.com> | 2016-07-27 11:29:25 +1200 |
---|---|---|
committer | Adam Buczynski <adambuczynski@gmail.com> | 2016-07-27 11:29:25 +1200 |
commit | 7da7ab726d1b7a3375b6b4b9ceef88755270b0e2 (patch) | |
tree | b9f4020f12ccdece33ed18e64a353bb650b438d1 /lib/helpers/error.js | |
parent | 1342ecde82d7af2f5098632b467563b17d9b8d5d (diff) | |
download | sendgrid-nodejs-7da7ab726d1b7a3375b6b4b9ceef88755270b0e2.zip sendgrid-nodejs-7da7ab726d1b7a3375b6b4b9ceef88755270b0e2.tar.gz sendgrid-nodejs-7da7ab726d1b7a3375b6b4b9ceef88755270b0e2.tar.bz2 |
New API
Diffstat (limited to 'lib/helpers/error.js')
-rw-r--r-- | lib/helpers/error.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/helpers/error.js b/lib/helpers/error.js new file mode 100644 index 0000000..2beb886 --- /dev/null +++ b/lib/helpers/error.js @@ -0,0 +1,20 @@ +'use strict'; + +//Error constructor +function SendGridError(message) { + this.message = message; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + else { + this.stack = (new Error()).stack; + } +} + +//Extend prototype +SendGridError.prototype = new Error(); +SendGridError.prototype.constructor = SendGridError; +SendGridError.prototype.name = 'SendGridError'; + +//Export +module.exports = SendGridError; |