ChrisVilches/Term-Keep

Use `anyhow`

Opened this issue · 2 comments

Seems to be better than using Result<T, Box<dyn Error>> all the time.

Note: I don't only use Result<T, Box<dyn Error>>, but also Result<Self, &str> and Result<ToSqlOutput<'_>, rusqlite::Error>, and others. So, is it really easy to implement?

I think a good way would be to keep using std Result but only change the Result<T, Box<dyn Error>> ones to Anyhow.

I think this is implemented. Must verify.

~/Term-Keep ᐅ search-text anyhow
./Cargo.lock:name = "anyhow"
./Cargo.lock: "anyhow",
./src/models/task_status.rs:use anyhow::{anyhow, Result};
./src/models/task_status.rs:      _ => Err(anyhow!(INVALID_STATUS_ERROR)),
./src/util/cli.rs:use anyhow::{anyhow, bail, Result};
./src/util/cli.rs:    Err(anyhow!(
./src/cli/parser.rs:use anyhow::Result;
./src/controllers/tasks.rs:use anyhow::{anyhow, Result};
./src/controllers/tasks.rs:    NoteType::Normal => Err(anyhow!("Not a task")),
./src/controllers/templates.rs:use anyhow::Result;
./src/controllers/note_edit.rs:use anyhow::{bail, Result};
./src/controllers/info.rs:use anyhow::Result;
./src/controllers/note_display.rs:use anyhow::Result;
./src/controllers/note_creation.rs:use anyhow::Result;
./Cargo.toml:anyhow = "1.0.69"