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:
parent
32e65545ae
commit
14eba436bf
1 changed files with 4 additions and 2 deletions
|
|
@ -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});
|
||||
|
|
|
|||
Loading…
Reference in a new issue