refactor(cli): update errors.zig to use io.zig
Update errors.zig to use consolidated io module: - Replace colors.printError with io.printError - Replace colors.printWarning with io.printWarning - Replace colors.printInfo with io.printInfo All tests pass.
This commit is contained in:
parent
6c192e5144
commit
02b64be999
1 changed files with 9 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
|||
const std = @import("std");
|
||||
const colors = @import("utils/colors.zig");
|
||||
const io = @import("utils/io.zig");
|
||||
const crypto = @import("utils/crypto.zig");
|
||||
|
||||
/// User-friendly error types for CLI
|
||||
|
|
@ -143,18 +143,18 @@ pub const ErrorHandler = struct {
|
|||
const message = ErrorMessages.getMessage(err);
|
||||
const suggestion = ErrorMessages.getSuggestion(err);
|
||||
|
||||
colors.printError("Error: {s}\n", .{message});
|
||||
io.printError("Error: {s}\n", .{message});
|
||||
|
||||
if (context) |ctx| {
|
||||
colors.printWarning("Context: {s}\n", .{ctx});
|
||||
io.printWarning("Context: {s}\n", .{ctx});
|
||||
}
|
||||
|
||||
if (suggestion) |sug| {
|
||||
colors.printInfo("Suggestion: {s}\n", .{sug});
|
||||
io.printInfo("Suggestion: {s}\n", .{sug});
|
||||
}
|
||||
|
||||
if (ErrorMessages.isUserFixable(err)) {
|
||||
colors.printInfo("This error can be fixed by updating your configuration.\n", .{});
|
||||
io.printInfo("This error can be fixed by updating your configuration.\n", .{});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,16 +169,16 @@ pub const ErrorHandler = struct {
|
|||
const suggestion = ErrorMessages.getSuggestion(err);
|
||||
const is_fixable = ErrorMessages.isUserFixable(err);
|
||||
|
||||
colors.printError("Error in '{s}': {s}\n", .{ command, message });
|
||||
io.printError("Error in '{s}': {s}\n", .{ command, message });
|
||||
|
||||
if (suggestion) |sug| {
|
||||
colors.printInfo("Suggestion: {s}\n", .{sug});
|
||||
io.printInfo("Suggestion: {s}\n", .{sug});
|
||||
}
|
||||
|
||||
if (is_fixable) {
|
||||
colors.printInfo("This is a user-fixable issue.\n", .{});
|
||||
io.printInfo("This is a user-fixable issue.\n", .{});
|
||||
} else {
|
||||
colors.printWarning("If this persists, check server logs or contact support.\n", .{});
|
||||
io.printWarning("If this persists, check server logs or contact support.\n", .{});
|
||||
}
|
||||
|
||||
// Exit with appropriate code
|
||||
|
|
|
|||
Loading…
Reference in a new issue