From 23ceff79cac5161fab969445db216732e2b81bc8 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Tue, 7 Nov 2017 00:14:31 -0500 Subject: [PATCH] Add missing scripts/ex/error-subtype.js Oops! scripts/ex/error-subtype.js: Add file. --- scripts/ex/error-subtype.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/ex/error-subtype.js diff --git a/scripts/ex/error-subtype.js b/scripts/ex/error-subtype.js new file mode 100644 index 0000000..c26d562 --- /dev/null +++ b/scripts/ex/error-subtype.js @@ -0,0 +1,15 @@ +const MyError = Class( 'MyError' ) + .extend( Error, {} ); + +const e = MyError( 'Foo' ); +e.message; // Foo +e.name; // MyError + +// -- if supported by environment -- +e.stack; // stack beginning at caller +e.fileName; // caller filename +e.lineNumber; // caller line number +e.columnNumber; // caller column number + +// general case +throw MyError( 'Foo' );