1
0
Fork 0

Add missing scripts/ex/error-subtype.js

Oops!

scripts/ex/error-subtype.js: Add file.
website
Mike Gerwitz 2017-11-07 00:14:31 -05:00
parent 6f029a3f45
commit 23ceff79ca
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
1 changed files with 15 additions and 0 deletions

View File

@ -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' );