From 68daa10abfe3015beca966825d32cf67c9f5d5d7 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 18 Jun 2026 20:56:05 +0800 Subject: feat(bucket): implement bucket initialization and logging infrastructure Add bucket init logic with directory structure creation and log macros for tracing --- rola-cli/src/error/io.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'rola-cli/src/error') diff --git a/rola-cli/src/error/io.rs b/rola-cli/src/error/io.rs index 7e4de56..d65b765 100644 --- a/rola-cli/src/error/io.rs +++ b/rola-cli/src/error/io.rs @@ -61,7 +61,14 @@ pub enum ErrorIo { pub fn render_error_io(err: ErrorIo, ec: &mut ResExitCode) { let err: std::io::Error = err.into(); let content = format!("{:?}", err); - let (error_info, exit_code) = match err.kind() { + let (error_info, exit_code) = io_error_info(err, content); + + r_println!("{}{}", I18nIoError::io_error_name(), error_info); + ec.exit_code = exit_code; +} + +fn io_error_info(err: std::io::Error, content: String) -> (String, i32) { + match err.kind() { std::io::ErrorKind::NotFound => (I18nIoError::not_found(content), EC_IOERR_NOT_FOUND), std::io::ErrorKind::PermissionDenied => ( I18nIoError::permission_denied(content), @@ -185,10 +192,7 @@ pub fn render_error_io(err: ErrorIo, ec: &mut ResExitCode) { } std::io::ErrorKind::Other => (I18nIoError::other(content), EC_IOERR_OTHER), _ => (I18nIoError::other(content), EC_IOERR_OTHER), - }; - - r_println!("{}: {}", I18nIoError::io_error_name(), error_info); - ec.exit_code = exit_code; + } } impl From for ErrorIo { -- cgit