zig: make throwPretty use JSError (#15410)

This commit is contained in:
Meghan Denny
2024-11-25 18:08:42 -08:00
committed by GitHub
parent 8ca0eb831d
commit c434b2c191
7 changed files with 224 additions and 447 deletions

View File

@@ -4398,8 +4398,7 @@ pub const TestingAPIs = struct {
if (lex_result.errors.len > 0) {
const str = lex_result.combineErrors(arena.allocator());
globalThis.throwPretty("{s}", .{str});
return .zero;
return globalThis.throwPretty("{s}", .{str});
}
var test_tokens = std.ArrayList(Test.TestToken).initCapacity(arena.allocator(), lex_result.tokens.len) catch {
@@ -4475,14 +4474,12 @@ pub const TestingAPIs = struct {
if (err == ParseError.Lex) {
if (bun.Environment.allow_assert) assert(out_lex_result != null);
const str = out_lex_result.?.combineErrors(arena.allocator());
globalThis.throwPretty("{s}", .{str});
return .zero;
return globalThis.throwPretty("{s}", .{str});
}
if (out_parser) |*p| {
const errstr = p.combineErrors();
globalThis.throwPretty("{s}", .{errstr});
return .zero;
return globalThis.throwPretty("{s}", .{errstr});
}
return globalThis.throwError(err, "failed to lex/parse shell");