@util.js/errors 0.41.3 → 0.41.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/AsyncError.js +6 -7
- package/dist/Errors.js +1 -2
- package/dist/FalsyError.js +7 -9
- package/dist/MissingError.js +7 -9
- package/dist/RethrownError.js +6 -7
- package/doc/README-examples.js +2 -2
- package/lib/AsyncError.js +2 -2
- package/lib/FalsyError.js +1 -1
- package/lib/MissingError.js +1 -1
- package/lib/RethrownError.js +1 -1
- package/package.json +2 -3
- package/test/ErrorsTest.js +9 -9
- package/test/Errors_FalsyError_check_Test.js +4 -4
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
<p>
|
|
6
6
|
<a href="https://www.npmjs.com/package/@util.js/errors"><img alt="NPM Status" src="https://img.shields.io/npm/v/@util.js/errors.svg?style=flat"></a>
|
|
7
|
-
<a href="https://travis-ci.org/creemama/utiljs"><img alt="Travis CI Build Status" src="https://img.shields.io/travis/creemama/utiljs/master.svg?style=flat-square&label=Travis+CI"></a>
|
|
8
7
|
</p>
|
|
9
8
|
|
|
10
9
|
@util.js/errors is part of [Util.js](https://github.com/creemama/utiljs).
|
|
@@ -154,7 +153,7 @@ errors
|
|
|
154
153
|
// at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
|
|
155
154
|
|
|
156
155
|
rejectAPromise().catch((error) =>
|
|
157
|
-
console.log("\n\nWithout Caller Stack Trace\n" + error.stack)
|
|
156
|
+
console.log("\n\nWithout Caller Stack Trace\n" + error.stack),
|
|
158
157
|
);
|
|
159
158
|
// Without Caller Stack Trace
|
|
160
159
|
// TypeError: Fail!
|
package/dist/AsyncError.js
CHANGED
|
@@ -10,20 +10,18 @@ var _splice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
10
10
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
14
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
15
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
16
16
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
|
|
17
|
-
function
|
|
18
|
-
function _isNativeReflectConstruct() {
|
|
17
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
18
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
19
19
|
module.exports = /*#__PURE__*/function (_Error) {
|
|
20
|
-
(0, _inherits2["default"])(AsyncError, _Error);
|
|
21
|
-
var _super = _createSuper(AsyncError);
|
|
22
20
|
function AsyncError(callerError, asyncError, message) {
|
|
23
21
|
var _context, _context2, _context3, _context4, _context5;
|
|
24
22
|
var _this;
|
|
25
23
|
(0, _classCallCheck2["default"])(this, AsyncError);
|
|
26
|
-
_this =
|
|
24
|
+
_this = _callSuper(this, AsyncError, [message != null ? message : getErrorProperty(asyncError, "message")]);
|
|
27
25
|
if (!callerError) throw new TypeError((0, _concat["default"])(_context = "".concat(_this.constructor.name, "'s constructor expects a defined callerError, but it was ")).call(_context, callerError, "."));
|
|
28
26
|
if (!asyncError) throw new TypeError((0, _concat["default"])(_context2 = "".concat(_this.constructor.name, "'s constructor expects a defined asyncError, but it was ")).call(_context2, asyncError, "."));
|
|
29
27
|
_this.name = _this.constructor.name;
|
|
@@ -36,8 +34,9 @@ module.exports = /*#__PURE__*/function (_Error) {
|
|
|
36
34
|
_this.stack = (0, _concat["default"])(_context4 = (0, _concat["default"])(_context5 = "".concat(_this.stack, "\n")).call(_context5, callerStack, "\n")).call(_context4, asyncErrorStack);
|
|
37
35
|
return _this;
|
|
38
36
|
}
|
|
37
|
+
(0, _inherits2["default"])(AsyncError, _Error);
|
|
39
38
|
return (0, _createClass2["default"])(AsyncError);
|
|
40
|
-
}(
|
|
39
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2["default"])(Error));
|
|
41
40
|
function getErrorProperty(error, property) {
|
|
42
41
|
if (error[property]) return error[property];
|
|
43
42
|
try {
|
package/dist/Errors.js
CHANGED
|
@@ -13,7 +13,7 @@ module.exports = /*#__PURE__*/function () {
|
|
|
13
13
|
function Errors() {
|
|
14
14
|
(0, _classCallCheck2["default"])(this, Errors);
|
|
15
15
|
}
|
|
16
|
-
(0, _createClass2["default"])(Errors, [{
|
|
16
|
+
return (0, _createClass2["default"])(Errors, [{
|
|
17
17
|
key: "catch",
|
|
18
18
|
value:
|
|
19
19
|
/**
|
|
@@ -162,5 +162,4 @@ module.exports = /*#__PURE__*/function () {
|
|
|
162
162
|
return require("./RethrownError");
|
|
163
163
|
}
|
|
164
164
|
}]);
|
|
165
|
-
return Errors;
|
|
166
165
|
}();
|
package/dist/FalsyError.js
CHANGED
|
@@ -4,29 +4,27 @@ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
5
5
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
6
6
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
7
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
8
7
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
9
8
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
9
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
10
10
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
|
|
11
|
-
function
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
11
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
module.exports = /*#__PURE__*/function (_TypeError) {
|
|
14
|
-
(0, _inherits2["default"])(FalsyError, _TypeError);
|
|
15
|
-
var _super = _createSuper(FalsyError);
|
|
16
14
|
function FalsyError(argumentValue, argumentName, functionName) {
|
|
17
15
|
var _this;
|
|
18
16
|
(0, _classCallCheck2["default"])(this, FalsyError);
|
|
19
|
-
_this =
|
|
17
|
+
_this = _callSuper(this, FalsyError, [argumentValue ? "Why are you creating a FalsyError with a truthy `argumentValue`: '" + argumentValue + "'?" : (functionName || "We") + " expected " + (argumentName ? "`" + argumentName + "`" : "an argument") + " to be truthy. " + (argumentName ? "`" + argumentName + "`" : "It") + " is the falsy value " + (argumentValue === "" ? "''" : argumentValue) + "."]);
|
|
20
18
|
_this.name = _this.constructor.name;
|
|
21
19
|
_this.argumentName = argumentName;
|
|
22
20
|
return _this;
|
|
23
21
|
}
|
|
24
|
-
(0,
|
|
22
|
+
(0, _inherits2["default"])(FalsyError, _TypeError);
|
|
23
|
+
return (0, _createClass2["default"])(FalsyError, null, [{
|
|
25
24
|
key: "check",
|
|
26
25
|
value: function check(argumentValue, argumentName, functionName) {
|
|
27
26
|
if (argumentValue) return;
|
|
28
27
|
throw new FalsyError(argumentValue, argumentName, functionName);
|
|
29
28
|
}
|
|
30
29
|
}]);
|
|
31
|
-
|
|
32
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(TypeError));
|
|
30
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2["default"])(TypeError));
|
package/dist/MissingError.js
CHANGED
|
@@ -4,29 +4,27 @@ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
5
5
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
6
6
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
7
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
8
7
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
9
8
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
9
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
10
10
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
|
|
11
|
-
function
|
|
12
|
-
function _isNativeReflectConstruct() {
|
|
11
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
13
|
module.exports = /*#__PURE__*/function (_TypeError) {
|
|
14
|
-
(0, _inherits2["default"])(MissingError, _TypeError);
|
|
15
|
-
var _super = _createSuper(MissingError);
|
|
16
14
|
function MissingError(argumentValue, argumentName, functionName) {
|
|
17
15
|
var _this;
|
|
18
16
|
(0, _classCallCheck2["default"])(this, MissingError);
|
|
19
|
-
_this =
|
|
17
|
+
_this = _callSuper(this, MissingError, [argumentValue != null ? "Why are you creating a MissingError with a defined `argumentValue`: '" + argumentValue + "'?" : (functionName || "We") + " expected " + (argumentName ? "`" + argumentName + "`" : "an argument") + " to be defined. " + (argumentName ? "`" + argumentName + "`" : "It") + " is '" + argumentValue + "'."]);
|
|
20
18
|
_this.name = _this.constructor.name;
|
|
21
19
|
_this.argumentName = argumentName;
|
|
22
20
|
return _this;
|
|
23
21
|
}
|
|
24
|
-
(0,
|
|
22
|
+
(0, _inherits2["default"])(MissingError, _TypeError);
|
|
23
|
+
return (0, _createClass2["default"])(MissingError, null, [{
|
|
25
24
|
key: "check",
|
|
26
25
|
value: function check(argumentValue, argumentName, functionName) {
|
|
27
26
|
if (argumentValue != null) return;
|
|
28
27
|
throw new MissingError(argumentValue, argumentName, functionName);
|
|
29
28
|
}
|
|
30
29
|
}]);
|
|
31
|
-
|
|
32
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(TypeError));
|
|
30
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2["default"])(TypeError));
|
package/dist/RethrownError.js
CHANGED
|
@@ -9,20 +9,18 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
9
9
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
13
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
14
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
15
15
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/wrapNativeSuper"));
|
|
16
|
-
function
|
|
17
|
-
function _isNativeReflectConstruct() {
|
|
16
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
18
|
module.exports = /*#__PURE__*/function (_Error) {
|
|
19
|
-
(0, _inherits2["default"])(RethrownError, _Error);
|
|
20
|
-
var _super = _createSuper(RethrownError);
|
|
21
19
|
function RethrownError(error, message) {
|
|
22
20
|
var _context;
|
|
23
21
|
var _this;
|
|
24
22
|
(0, _classCallCheck2["default"])(this, RethrownError);
|
|
25
|
-
_this =
|
|
23
|
+
_this = _callSuper(this, RethrownError, [message != null ? message : getErrorProperty(error, "message")]);
|
|
26
24
|
if (!error) throw new TypeError("RethrownError's constructor expects a defined error, but it was ".concat(error, "."));
|
|
27
25
|
_this.name = _this.constructor.name;
|
|
28
26
|
_this.original = error;
|
|
@@ -31,8 +29,9 @@ module.exports = /*#__PURE__*/function (_Error) {
|
|
|
31
29
|
_this.stack = (0, _concat["default"])(_context = "".concat(_this.stack, "\n")).call(_context, errorStack);
|
|
32
30
|
return _this;
|
|
33
31
|
}
|
|
32
|
+
(0, _inherits2["default"])(RethrownError, _Error);
|
|
34
33
|
return (0, _createClass2["default"])(RethrownError);
|
|
35
|
-
}(
|
|
34
|
+
}(/*#__PURE__*/(0, _wrapNativeSuper2["default"])(Error));
|
|
36
35
|
function getErrorProperty(error, property) {
|
|
37
36
|
if (error[property]) return error[property];
|
|
38
37
|
try {
|
package/doc/README-examples.js
CHANGED
|
@@ -23,7 +23,7 @@ function runExample0() {
|
|
|
23
23
|
errors
|
|
24
24
|
.catch(rejectAPromise())
|
|
25
25
|
.catch((error) =>
|
|
26
|
-
console.log("\n\nWith Caller Stack Trace\n" + error.stack)
|
|
26
|
+
console.log("\n\nWith Caller Stack Trace\n" + error.stack),
|
|
27
27
|
);
|
|
28
28
|
// With Caller Stack Trace
|
|
29
29
|
// AsyncError: Fail!
|
|
@@ -54,7 +54,7 @@ function runExample0() {
|
|
|
54
54
|
// at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
|
|
55
55
|
|
|
56
56
|
rejectAPromise().catch((error) =>
|
|
57
|
-
console.log("\n\nWithout Caller Stack Trace\n" + error.stack)
|
|
57
|
+
console.log("\n\nWithout Caller Stack Trace\n" + error.stack),
|
|
58
58
|
);
|
|
59
59
|
// Without Caller Stack Trace
|
|
60
60
|
// TypeError: Fail!
|
package/lib/AsyncError.js
CHANGED
|
@@ -8,11 +8,11 @@ module.exports = class AsyncError extends Error {
|
|
|
8
8
|
super(message != null ? message : getErrorProperty(asyncError, "message"));
|
|
9
9
|
if (!callerError)
|
|
10
10
|
throw new TypeError(
|
|
11
|
-
`${this.constructor.name}'s constructor expects a defined callerError, but it was ${callerError}
|
|
11
|
+
`${this.constructor.name}'s constructor expects a defined callerError, but it was ${callerError}.`,
|
|
12
12
|
);
|
|
13
13
|
if (!asyncError)
|
|
14
14
|
throw new TypeError(
|
|
15
|
-
`${this.constructor.name}'s constructor expects a defined asyncError, but it was ${asyncError}
|
|
15
|
+
`${this.constructor.name}'s constructor expects a defined asyncError, but it was ${asyncError}.`,
|
|
16
16
|
);
|
|
17
17
|
this.name = this.constructor.name;
|
|
18
18
|
this.original = asyncError;
|
package/lib/FalsyError.js
CHANGED
|
@@ -19,7 +19,7 @@ module.exports = class FalsyError extends TypeError {
|
|
|
19
19
|
(argumentName ? "`" + argumentName + "`" : "It") +
|
|
20
20
|
" is the falsy value " +
|
|
21
21
|
(argumentValue === "" ? "''" : argumentValue) +
|
|
22
|
-
"."
|
|
22
|
+
".",
|
|
23
23
|
);
|
|
24
24
|
this.name = this.constructor.name;
|
|
25
25
|
this.argumentName = argumentName;
|
package/lib/MissingError.js
CHANGED
package/lib/RethrownError.js
CHANGED
|
@@ -8,7 +8,7 @@ module.exports = class RethrownError extends Error {
|
|
|
8
8
|
super(message != null ? message : getErrorProperty(error, "message"));
|
|
9
9
|
if (!error)
|
|
10
10
|
throw new TypeError(
|
|
11
|
-
`RethrownError's constructor expects a defined error, but it was ${error}
|
|
11
|
+
`RethrownError's constructor expects a defined error, but it was ${error}.`,
|
|
12
12
|
);
|
|
13
13
|
this.name = this.constructor.name;
|
|
14
14
|
this.original = error;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Chris Topher <c@creemama.com>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@babel/runtime-corejs3": "7.
|
|
4
|
+
"@babel/runtime-corejs3": "7.29.7"
|
|
5
5
|
},
|
|
6
6
|
"description": "JavaScript utility methods for errors",
|
|
7
7
|
"keywords": [
|
|
@@ -25,6 +25,5 @@
|
|
|
25
25
|
"type": "git",
|
|
26
26
|
"url": "https://github.com/creemama/utiljs/tree/master/packages/utiljs-errors"
|
|
27
27
|
},
|
|
28
|
-
"version": "0.41.
|
|
29
|
-
"gitHead": "e17139b7f85c3abec178d8facdacc2aa6c5bb553"
|
|
28
|
+
"version": "0.41.5"
|
|
30
29
|
}
|
package/test/ErrorsTest.js
CHANGED
|
@@ -83,10 +83,10 @@ describe("new Errors#RethrownError(message, error)", () => {
|
|
|
83
83
|
throwATypeError();
|
|
84
84
|
} catch (error) {
|
|
85
85
|
expect(new RethrownError(error).stack).to.include(
|
|
86
|
-
"RethrownError: Invalid Argument\n"
|
|
86
|
+
"RethrownError: Invalid Argument\n",
|
|
87
87
|
);
|
|
88
88
|
expect(new RethrownError(error, "").stack).to.include(
|
|
89
|
-
"RethrownError\n"
|
|
89
|
+
"RethrownError\n",
|
|
90
90
|
);
|
|
91
91
|
throw new RethrownError(error, "Lorem Ipsum");
|
|
92
92
|
}
|
|
@@ -114,18 +114,18 @@ describe("new Errors#RethrownError(message, error)", () => {
|
|
|
114
114
|
throwAString();
|
|
115
115
|
} catch (error) {
|
|
116
116
|
expect(new RethrownError(error).stack).to.include(
|
|
117
|
-
'RethrownError: "ENTITY_NOT_FOUND"\n'
|
|
117
|
+
'RethrownError: "ENTITY_NOT_FOUND"\n',
|
|
118
118
|
);
|
|
119
119
|
expect(new RethrownError(error).stack.endsWith('"ENTITY_NOT_FOUND"')).to
|
|
120
120
|
.be.true;
|
|
121
121
|
expect(new RethrownError(error, "").stack).to.include(
|
|
122
|
-
"RethrownError\n"
|
|
122
|
+
"RethrownError\n",
|
|
123
123
|
);
|
|
124
124
|
expect(new RethrownError(error, 0).stack).to.include(
|
|
125
|
-
"RethrownError: 0\n"
|
|
125
|
+
"RethrownError: 0\n",
|
|
126
126
|
);
|
|
127
127
|
expect(new RethrownError(error, "").stack).to.include(
|
|
128
|
-
"ENTITY_NOT_FOUND"
|
|
128
|
+
"ENTITY_NOT_FOUND",
|
|
129
129
|
);
|
|
130
130
|
throw new RethrownError(error, "Lorem Ipsum");
|
|
131
131
|
}
|
|
@@ -152,15 +152,15 @@ describe("new Errors#RethrownError(message, error)", () => {
|
|
|
152
152
|
throwAnArray();
|
|
153
153
|
} catch (error) {
|
|
154
154
|
expect(new RethrownError(error).stack).to.include(
|
|
155
|
-
'RethrownError: [{"code":"1234"}]\n'
|
|
155
|
+
'RethrownError: [{"code":"1234"}]\n',
|
|
156
156
|
);
|
|
157
157
|
expect(new RethrownError(error).stack.endsWith('[{"code":"1234"}]')).to
|
|
158
158
|
.be.true;
|
|
159
159
|
expect(new RethrownError(error, "").stack).to.include(
|
|
160
|
-
"RethrownError\n"
|
|
160
|
+
"RethrownError\n",
|
|
161
161
|
);
|
|
162
162
|
expect(new RethrownError(error, "").stack).to.include(
|
|
163
|
-
'[{"code":"1234"}]'
|
|
163
|
+
'[{"code":"1234"}]',
|
|
164
164
|
);
|
|
165
165
|
throw new RethrownError(error, "Lorem Ipsum");
|
|
166
166
|
}
|
|
@@ -11,7 +11,7 @@ describe("FalsyError#check", () => {
|
|
|
11
11
|
} catch (e) {
|
|
12
12
|
expect(e).to.be.an.instanceof(FalsyError);
|
|
13
13
|
expect(e.message).to.equal(
|
|
14
|
-
"Lawyer#argue expected `argument` to be truthy. `argument` is the falsy value NaN."
|
|
14
|
+
"Lawyer#argue expected `argument` to be truthy. `argument` is the falsy value NaN.",
|
|
15
15
|
);
|
|
16
16
|
expect(e.argumentName).to.equal("argument");
|
|
17
17
|
}
|
|
@@ -24,7 +24,7 @@ describe("FalsyError#check", () => {
|
|
|
24
24
|
} catch (e) {
|
|
25
25
|
expect(e).to.be.an.instanceof(FalsyError);
|
|
26
26
|
expect(e.message).to.equal(
|
|
27
|
-
"We expected `argument` to be truthy. `argument` is the falsy value false."
|
|
27
|
+
"We expected `argument` to be truthy. `argument` is the falsy value false.",
|
|
28
28
|
);
|
|
29
29
|
expect(e.argumentName).to.equal("argument");
|
|
30
30
|
}
|
|
@@ -37,7 +37,7 @@ describe("FalsyError#check", () => {
|
|
|
37
37
|
} catch (e) {
|
|
38
38
|
expect(e).to.be.an.instanceof(FalsyError);
|
|
39
39
|
expect(e.message).to.equal(
|
|
40
|
-
"Lawyer#argue expected an argument to be truthy. It is the falsy value undefined."
|
|
40
|
+
"Lawyer#argue expected an argument to be truthy. It is the falsy value undefined.",
|
|
41
41
|
);
|
|
42
42
|
expect(e.argumentName).to.be.null;
|
|
43
43
|
}
|
|
@@ -50,7 +50,7 @@ describe("FalsyError#check", () => {
|
|
|
50
50
|
} catch (e) {
|
|
51
51
|
expect(e).to.be.an.instanceof(FalsyError);
|
|
52
52
|
expect(e.message).to.equal(
|
|
53
|
-
"We expected an argument to be truthy. It is the falsy value null."
|
|
53
|
+
"We expected an argument to be truthy. It is the falsy value null.",
|
|
54
54
|
);
|
|
55
55
|
expect(e.argumentName).to.be.undefined;
|
|
56
56
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright 2018 Chris Topher (c@creemama.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
-
so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|