Created
January 11, 2011 06:15
-
-
Save mgutz/774103 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
assert = require('assert') | |
class MyError | |
constructor: (@message, @name='bar') -> #nop | |
try | |
throw new Error('baz') | |
throw new MyError('foo') | |
catch err | |
console.log err.message | |
console.log err.name | |
# ok | |
assert.throws (-> throw new MyError('foo')), MyError | |
# fail | |
assert.throws (-> throw new Error('plain')), MyError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment