summaryrefslogtreecommitdiffstats
path: root/lib/helpers/error.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/helpers/error.js')
-rw-r--r--lib/helpers/error.js20
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;