Skip to content

Instantly share code, notes, and snippets.

@mgutz
Created January 11, 2011 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgutz/774103 to your computer and use it in GitHub Desktop.
Save mgutz/774103 to your computer and use it in GitHub Desktop.
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