custom-error
Version:
Create custom errors that inherit Error
21 lines (15 loc) • 327 B
JavaScript
var test = require('tape')
var error = require('../')
test('throw', function(t) {
t.plan(2)
var MyError = error('MyError')
var f
f = function() {
throw MyError()
}
t.throws(f, MyError, 'Should throw MyError')
f = function() {
throw new MyError()
}
t.throws(f, MyError, 'Should throw MyError')
})