Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit f1c80b1

Browse files
committed
feat(minErr): add optional ErrorConstructor argument for symmetry with original
1 parent b531edf commit f1c80b1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/minErr.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
function minErr(module) {
1+
function minErr(module, ErrorConstructor) {
2+
ErrorConstructor = ErrorConstructor || Error;
23
var stringify = function (arg) {
34
if (typeof arg == 'function') {
45
return arg.toString().replace(/ \{[\s\S]*$/, '');
@@ -19,6 +20,6 @@ function minErr(module) {
1920
message = message + (i == 1 ? '?' : '&') + 'p' + (i-1) + '=' +
2021
encodeURIComponent(stringify(arguments[i]));
2122
}
22-
return new Error(message);
23+
return new ErrorConstructor(message);
2324
};
24-
}
25+
}

0 commit comments

Comments
 (0)