Skip to content

Commit 06d316a

Browse files
committed
Correct some error types and try and clean up the README
1 parent ba1ff4d commit 06d316a

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<div align="center">
2-
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="">
4-
<source media="(prefers-color-scheme: light)" srcset="">
5-
<img alt="Logo" src="" width="520">
6-
</picture>
2+
3+
```
4+
░██ ░██ ░███ ░██████ ░███ ░███ ░██████░███ ░██ ░███████
5+
░██ ░██ ░██░██ ░██ ░██ ░████ ░████ ░██ ░████ ░██ ░██ ░██
6+
░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██░██ ░██ ░██░██ ░██ ░██ ░██
7+
░██ ░████ ░██ ░█████████ ░████████ ░██ ░████ ░██ ░██ ░██ ░██ ░██ ░██ ░██
8+
░██░██ ░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██
9+
░████ ░████ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██
10+
░███ ░███ ░██ ░██ ░██████ ░██ ░██ ░██████░██ ░███ ░███████
11+
```
12+
713
</div>
814

915
<p align="center">

crates/wasmind_cli/src/bin/tui_preview/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ enum Scenario {
2323

2424
#[tokio::main]
2525
async fn main() -> Result<(), Box<dyn std::error::Error>> {
26-
init_logger_with_path("log.txt");
26+
init_logger_with_path("log.txt").unwrap();
2727

2828
let args = Args::parse();
2929

crates/wasmind_cli/src/commands/clean.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::{TuiResult, utils};
1+
use snafu::ResultExt;
2+
3+
use crate::{IoSnafu, TuiResult, utils};
24

35
pub fn clean_cache() -> TuiResult<()> {
46
let actors_cache_dir = wasmind::wasmind_config::get_actors_cache_dir()?;
@@ -11,7 +13,7 @@ pub fn clean_cache() -> TuiResult<()> {
1113
println!("Cleaning actor cache at {}...", actors_cache_dir.display());
1214

1315
// Remove the entire actors cache directory
14-
utils::remove_actors_cache(&actors_cache_dir)?;
16+
utils::remove_actors_cache(&actors_cache_dir).context(IoSnafu)?;
1517

1618
println!("✓ Actor cache cleaned successfully");
1719
Ok(())

crates/wasmind_cli/src/commands/info.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::{TuiResult, utils};
1+
use snafu::ResultExt;
2+
3+
use crate::{IoSnafu, TuiResult, utils};
24

35
pub fn show_info() -> TuiResult<()> {
46
println!("Wasmind Configuration and Cache Information");
@@ -20,7 +22,7 @@ pub fn show_info() -> TuiResult<()> {
2022
println!("\nCache directory: {}", cache_dir.display());
2123

2224
let actors_cache_dir = wasmind::wasmind_config::get_actors_cache_dir()?;
23-
let cached_count = utils::count_cached_actors(&actors_cache_dir)?;
25+
let cached_count = utils::count_cached_actors(&actors_cache_dir).context(IoSnafu)?;
2426

2527
if cached_count > 0 {
2628
println!(

crates/wasmind_cli/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use snafu::Snafu;
1+
use snafu::{ResultExt, Snafu};
22
use tracing_subscriber::{EnvFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt};
33

44
pub mod commands;
@@ -39,7 +39,7 @@ pub enum Error {
3939
source: litellm_manager::LiteLLMError,
4040
},
4141

42-
#[snafu(transparent)]
42+
#[snafu(display("IO error: {}", source))]
4343
Io {
4444
#[snafu(source)]
4545
source: std::io::Error,
@@ -55,10 +55,10 @@ pub enum Error {
5555

5656
pub type TuiResult<T> = Result<T, Error>;
5757

58-
pub fn init_logger_with_path<P: AsRef<std::path::Path>>(log_path: P) {
58+
pub fn init_logger_with_path<P: AsRef<std::path::Path>>(log_path: P) -> TuiResult<()> {
5959
// Create parent directory if it doesn't exist
6060
if let Some(parent) = log_path.as_ref().parent() {
61-
let _ = std::fs::create_dir_all(parent);
61+
std::fs::create_dir_all(parent).context(IoSnafu)?;
6262
}
6363

6464
let file = std::fs::OpenOptions::new()
@@ -87,4 +87,6 @@ pub fn init_logger_with_path<P: AsRef<std::path::Path>>(log_path: P) {
8787
.compact(),
8888
)
8989
.init();
90+
91+
Ok(())
9092
}

crates/wasmind_cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async fn main() -> TuiResult<()> {
2222
} else {
2323
wasmind::wasmind_config::get_log_file_path()?
2424
};
25-
init_logger_with_path(log_file);
25+
init_logger_with_path(log_file)?;
2626

2727
// Handle info, clean, and status commands before loading configuration
2828
match &cli.command {

0 commit comments

Comments
 (0)