authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-02 14:21:46 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-02 14:21:46 -07:00
log88adecd0f9a6e2fd9de65d0f1852bbde1e183590
treec627ab29b65a8b977fec9b18f9dfa43c598f0eed
parent27d7354d9dc44982f1de40706721aee7d9c998a5
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

move the @errorCast calls to the catch block to preserve error return trace

mitigates zig/issues/20177

1 files changed, 2 insertions(+), 2 deletions(-)

json.zig+2-2
...@@ -40,7 +40,7 @@ pub fn parseFromSlice(alloc: std.mem.Allocator, path: string, input: string, opt...@@ -40,7 +40,7 @@ pub fn parseFromSlice(alloc: std.mem.Allocator, path: string, input: string, opt
40}40}
4141
42fn parseElementPrecise(alloc: std.mem.Allocator, p: *Parser, comptime E: type) E!ValueIndex {42fn parseElementPrecise(alloc: std.mem.Allocator, p: *Parser, comptime E: type) E!ValueIndex {
43 return @errorCast(parseElement(alloc, p));43 return parseElement(alloc, p) catch |err| @errorCast(err);
44}44}
4545
46fn parseElement(alloc: std.mem.Allocator, p: *Parser) anyerror!ValueIndex {46fn parseElement(alloc: std.mem.Allocator, p: *Parser) anyerror!ValueIndex {
...@@ -433,7 +433,7 @@ pub const Document = struct {...@@ -433,7 +433,7 @@ pub const Document = struct {
433 pub fn stringify(this: *const Document, writer: anytype, space: Space, indent: u8) Instance(@TypeOf(writer)).WriteError!void {433 pub fn stringify(this: *const Document, writer: anytype, space: Space, indent: u8) Instance(@TypeOf(writer)).WriteError!void {
434 const fill = space.fill();434 const fill = space.fill();
435 try writer.writeNTimes(fill, indent);435 try writer.writeNTimes(fill, indent);
436 return @errorCast(this.root.stringify(writer, space, indent));436 return this.root.stringify(writer, space, indent) catch |err| @errorCast(err);
437 }437 }
438};438};
439439