mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-04 06:23:45 +00:00
Improve ergonomics of try catch (and Function's tryCall)
It now returns a Caught struct which contains all information. The Caught struct can be logged directly, providing more consistent logs for caught errors.
This commit is contained in:
@@ -407,8 +407,8 @@ fn runWebApiTest(test_file: [:0]const u8) !void {
|
||||
test_browser.runMicrotasks();
|
||||
|
||||
js_context.eval("testing.assertOk()", "testing.assertOk()") catch |err| {
|
||||
const msg = try_catch.err(arena_allocator) catch @errorName(err) orelse "unknown";
|
||||
std.debug.print("{s}: test failure\nError: {s}\n", .{ test_file, msg });
|
||||
const caught = try_catch.caughtOrError(arena_allocator, err);
|
||||
std.debug.print("{s}: test failure\nError: {f}\n", .{ test_file, caught });
|
||||
return err;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user