feat(cli): include command name in error messages and crash reports

Implement TODO in handleCommandError:
- Log command name with error for crash report context
- Display 'Error in \'{s}': {s}' instead of generic 'Error: {s}'
- Helps users identify which command failed

Build verified: zig build --release=fast
This commit is contained in:
Jeremie Fraeys 2026-02-18 13:51:13 -05:00
parent 32e65545ae
commit 14eba436bf
No known key found for this signature in database

View file

@ -159,7 +159,9 @@ pub const ErrorHandler = struct {
}
pub fn handleCommandError(err: anyerror, command: []const u8) void {
_ = command; // TODO: Use command in crash report
// Include command in crash report context
std.log.debug("Command '{s}' failed with error: {}", .{ command, err });
// Send crash report for non-user-fixable errors
sendCrashReport();
@ -167,7 +169,7 @@ pub const ErrorHandler = struct {
const suggestion = ErrorMessages.getSuggestion(err);
const is_fixable = ErrorMessages.isUserFixable(err);
colors.printError("Error: {s}\n", .{message});
colors.printError("Error in '{s}': {s}\n", .{ command, message });
if (suggestion) |sug| {
colors.printInfo("Suggestion: {s}\n", .{sug});