|
|
|
|
|
by maleldil
310 days ago
|
|
> Are libraries typically designed to accept an optional input to store potential errors? Yes. Stdlib's JSON module has a separate diagnostics object [1]. IMO, this is the weakest part of Zig's error handling story, although the reasons for this are understandable. [1] https://ziglang.org/documentation/master/std/#std.json.Scann... |
|
On the other hand the std.zon author did not make this mistake, i.e. `std.zon.parse.fromSlice` takes an optional Diagnostics struct which gives you all the information you need (including a handy format method for printing human readable messages).