@jsenv/test 3.0.18 → 3.0.19

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.
@@ -845,7 +845,9 @@ const createException = (reason, { rootDirectoryUrl } = {}) => {
845
845
  }
846
846
  reason.stackTrace = stackTrace;
847
847
  let stack = "";
848
- const name = reason.name || "Error";
848
+ const name = reason.constructor
849
+ ? reason.constructor.name
850
+ : reason.name || "Error";
849
851
  const message = reason.message || "";
850
852
  stack += `${name}: ${message}`;
851
853
  if (stackTrace) {
@@ -876,7 +878,7 @@ const createException = (reason, { rootDirectoryUrl } = {}) => {
876
878
  if (isError) {
877
879
  // getOwnPropertyNames is not enough to copy .name and .message
878
880
  // on error instances
879
- exception.name = reason.name;
881
+ exception.name = reason.constructor ? reason.constructor.name : reason.name;
880
882
  exception.message = reason.message;
881
883
  }
882
884
  return exception;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.0.18",
3
+ "version": "3.0.19",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "@jsenv/filesystem": "4.6.8",
43
43
  "@jsenv/github-check-run": "0.1.13",
44
44
  "@jsenv/humanize": "1.1.2",
45
- "@jsenv/plugin-supervisor": "1.4.6",
45
+ "@jsenv/plugin-supervisor": "1.4.7",
46
46
  "@jsenv/url-meta": "8.4.0",
47
47
  "@jsenv/urls": "2.2.6",
48
48
  "@jsenv/utils": "2.1.1",
@@ -159,7 +159,9 @@ export const createException = (reason, { rootDirectoryUrl } = {}) => {
159
159
  }
160
160
  reason.stackTrace = stackTrace;
161
161
  let stack = "";
162
- const name = reason.name || "Error";
162
+ const name = reason.constructor
163
+ ? reason.constructor.name
164
+ : reason.name || "Error";
163
165
  const message = reason.message || "";
164
166
  stack += `${name}: ${message}`;
165
167
  if (stackTrace) {
@@ -190,7 +192,7 @@ export const createException = (reason, { rootDirectoryUrl } = {}) => {
190
192
  if (isError) {
191
193
  // getOwnPropertyNames is not enough to copy .name and .message
192
194
  // on error instances
193
- exception.name = reason.name;
195
+ exception.name = reason.constructor ? reason.constructor.name : reason.name;
194
196
  exception.message = reason.message;
195
197
  }
196
198
  return exception;