From 8d484daa3a1b4491c0329735b1a84933e4308519 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Fri, 26 Aug 2016 21:29:57 -0600 Subject: [PATCH] Enigma error objects --- core/enig_error.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 core/enig_error.js diff --git a/core/enig_error.js b/core/enig_error.js new file mode 100644 index 00000000..69722a85 --- /dev/null +++ b/core/enig_error.js @@ -0,0 +1,19 @@ +/* jslint node: true */ +'use strict'; + +class EnigError extends Error { + constructor(message) { + super(message); + + this.name = this.constructor.name; + this.message = message; + + if(typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error(message)).stack; + } + } +} + +exports.EnigError = EnigError; \ No newline at end of file