mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 05:20:29 +00:00
config: richer diagnostics for errors
Rather than storing a list of errors we now store a list of "diagnostics." Each diagnostic has a richer set of structured information, including a message, a key, the location where it occurred. This lets us show more detailed messages, more human friendly messages, and also let's us filter by key or location. We don't take advantage of all of this capability in this initial commit, but we do use every field for something.
This commit is contained in:
@@ -55,9 +55,14 @@ pub fn run(alloc: std.mem.Allocator) !u8 {
|
||||
|
||||
try cfg.finalize();
|
||||
|
||||
if (!cfg._errors.empty()) {
|
||||
for (cfg._errors.list.items) |err| {
|
||||
try stdout.print("{s}\n", .{err.message});
|
||||
if (cfg._diagnostics.items().len > 0) {
|
||||
var buf = std.ArrayList(u8).init(alloc);
|
||||
defer buf.deinit();
|
||||
|
||||
for (cfg._diagnostics.items()) |diag| {
|
||||
try diag.write(buf.writer());
|
||||
try stdout.print("{s}\n", .{buf.items});
|
||||
buf.clearRetainingCapacity();
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user