Skip to content

Commit

Permalink
refactor: Use consistent error types throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Nov 7, 2023
1 parent bc09af7 commit 04e764d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use dioxus::prelude::{use_context, use_context_provider, use_future, Scope};
use dioxus_signals::{use_signal, Signal};
use dioxus_std::storage::{storage, LocalStorage};
use nix_health::NixHealth;
use nix_rs::{
command::NixCmdError,
flake::{url::FlakeUrl, Flake},
};
use nix_rs::flake::{url::FlakeUrl, Flake};

use self::datum::Datum;

Expand All @@ -29,7 +26,7 @@ pub struct AppState {
/// User selected [FlakeUrl]
pub flake_url: Signal<Option<FlakeUrl>>,
/// [Flake] for [AppState::flake_url]
pub flake: Signal<Datum<Result<Flake, NixCmdError>>>,
pub flake: Signal<Datum<Result<Flake, SystemError>>>,
/// List of recently selected [AppState::flake_url]s
pub recent_flakes: Signal<Vec<FlakeUrl>>,

Expand Down Expand Up @@ -123,6 +120,7 @@ impl AppState {
Datum::refresh_with(self.flake, async move {
Flake::from_nix(&nix_rs::command::NixCmd::default(), flake_url.clone())
.await
.map_err(|e| Into::<SystemError>::into(e.to_string()))
})
.await
}
Expand Down

0 comments on commit 04e764d

Please sign in to comment.