UNPKG
custom-err
Version:
latest (0.0.2)
0.0.2
0.0.1
Easily create an error with custom properties attached.
alessioalex/custom-err
custom-err
/
test.js
14 lines
(9 loc)
•
279 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
var
Err
=
require(
'./index'
),
assert
= require(
'assert'
);
var
myErr
=
Err(
'NotFound'
, { code:
404
});
assert
.equal(myErr.message,
'NotFound'
);
assert
.equal(myErr.code,
404
);
var
noPropsErr
=
Err(
'NotFound'
);
assert
.
throws
(function() { Err(); }, /argument missing/);