do not print duplicate code (#16231)

This commit is contained in:
chloe caruso
2025-01-07 20:19:12 -08:00
committed by GitHub
parent 7cc66a6a1e
commit 71d3b41351
3 changed files with 6 additions and 12 deletions

2
.mailmap Normal file
View File

@@ -0,0 +1,2 @@
# To learn more about git's mailmap: https://ntietz.com/blog/git-mailmap-for-name-changes
chloe caruso <git@paperclover.net> <me@paperdave.net>

View File

@@ -3974,15 +3974,7 @@ pub const VirtualMachine = struct {
// We special-case the code property. Let's avoid printing it twice.
if (field.eqlComptime("code")) {
if (value.isString()) {
const str = value.toBunString(this.global);
defer str.deref();
if (!str.isEmpty()) {
if (str.eql(name)) {
continue;
}
}
}
if (!iterator.tried_code_property) continue;
}
const kind = value.jsType();
@@ -4018,7 +4010,7 @@ pub const VirtualMachine = struct {
try writer.print(comptime Output.prettyFmt(" {}<r><d>:<r> ", allow_ansi_color), .{field});
// When we're printing errors for a top-level uncaught eception / rejection, suppress further errors here.
// When we're printing errors for a top-level uncaught exception / rejection, suppress further errors here.
if (allow_side_effects) {
if (this.global.hasException()) {
this.global.clearException();
@@ -4039,7 +4031,7 @@ pub const VirtualMachine = struct {
) catch {};
if (allow_side_effects) {
// When we're printing errors for a top-level uncaught eception / rejection, suppress further errors here.
// When we're printing errors for a top-level uncaught exception / rejection, suppress further errors here.
if (this.global.hasException()) {
this.global.clearException();
}

View File

@@ -114,10 +114,10 @@ test("throwing inside an error suppresses the error and continues printing prope
const { stderr, exitCode } = result;
expect(stderr.toString().trim()).toStartWith(`error: No such file or directory
code: "ENOENT",
path: "this-file-path-is-bad",
syscall: "open",
errno: -2,
code: "ENOENT",
`);
expect(exitCode).toBe(1);
});