Skip to content

Commit cdb2754

Browse files
committed
test string representation of subclassed errors
1 parent 11b8610 commit cdb2754

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

test/unit/error.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,16 @@ test.each(["Error", "RangeError", "ReferenceError", "SyntaxError", "TypeError",
315315
}
316316
);
317317

318-
test.each(["Error", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError"])(
318+
test.each(["Error", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError", "MyError"])(
319319
"throw builtin Errors as functions",
320320
errorType => {
321321
util.testFunction`
322+
class MyError extends Error {
323+
name: "MyError"
324+
}
325+
322326
try {
323-
throw ${errorType}("message")
327+
throw new ${errorType}("message")
324328
} catch (error) {
325329
if (error instanceof Error) {
326330
return \`\${error}\`;

0 commit comments

Comments
 (0)