diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-18 20:56:05 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-18 20:56:05 +0800 |
| commit | 68daa10abfe3015beca966825d32cf67c9f5d5d7 (patch) | |
| tree | c28f0470240e7cdc3748cee57ef74353514c47b7 /rola-cli/src/error | |
| parent | 669898193bebeadc975881bee496fe0239df76a0 (diff) | |
feat(bucket): implement bucket initialization and logging infrastructure
Add bucket init logic with directory structure creation and log macros
for tracing
Diffstat (limited to 'rola-cli/src/error')
| -rw-r--r-- | rola-cli/src/error/io.rs | 14 |
1 files changed, 9 insertions, 5 deletions
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<std::io::Error> for ErrorIo { |
