Make errors non-exhaustive (#299)

This commit is contained in:
Cole Helbling 2023-03-03 12:03:51 -08:00 committed by GitHub
parent d7c14d6695
commit 49154b9863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 18 additions and 1 deletions

View file

@ -105,6 +105,7 @@ impl Action for FetchAndUnpackNix {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum FetchUrlError {
#[error("Request error")]

View file

@ -96,6 +96,7 @@ impl Action for MoveUnpackedNix {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum MoveUnpackedNixError {
#[error("Glob pattern error")]

View file

@ -246,6 +246,7 @@ impl Action for SetupDefaultProfile {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum SetupDefaultProfileError {
#[error("Glob pattern error")]

View file

@ -333,6 +333,7 @@ impl Action for ConfigureInitService {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum ConfigureNixDaemonServiceError {
#[error("No supported init system found")]

View file

@ -107,6 +107,7 @@ impl Action for PlaceChannelConfiguration {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum PlaceChannelConfigurationError {
#[error("No root home found to place channel configuration in")]

View file

@ -138,6 +138,7 @@ impl Action for StartSystemdUnit {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum StartSystemdUnitError {
#[error("Failed to execute command")]

View file

@ -95,6 +95,7 @@ impl Action for BootstrapApfsVolume {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum BootstrapVolumeError {
#[error("Failed to execute command")]

View file

@ -136,6 +136,7 @@ impl Action for CreateApfsVolume {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum CreateApfsVolumeError {
#[error("Existing volume called `{0}` found in `diskutil apfs list`, delete it with `diskutil apfs deleteVolume \"{0}\"`")]

View file

@ -200,6 +200,7 @@ fn fstab_entry(uuid: &Uuid, apfs_volume_label: &str) -> String {
)
}
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum CreateFstabEntryError {
#[error("An `/etc/fstab` entry for the `/nix` path already exists, consider removing the entry for `/nix`d from `/etc/fstab`")]

View file

@ -88,6 +88,7 @@ impl Action for CreateSyntheticObjects {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum CreateSyntheticObjectsError {
#[error("Failed to execute command")]

View file

@ -93,6 +93,7 @@ impl Action for EnableOwnership {
}
}
#[non_exhaustive]
#[derive(Debug, thiserror::Error)]
pub enum EnableOwnershipError {
#[error("Failed to execute command")]

View file

@ -253,6 +253,7 @@ impl ActionDescription {
}
/// An error occurring during an action
#[non_exhaustive]
#[derive(thiserror::Error, Debug, strum::IntoStaticStr)]
pub enum ActionError {
/// A custom error

View file

@ -152,6 +152,7 @@ impl DiagnosticData {
}
}
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum DiagnosticError {
#[error("Unknown url scheme")]

View file

@ -3,6 +3,7 @@ use std::path::PathBuf;
use crate::{action::ActionError, planner::PlannerError, settings::InstallSettingsError};
/// An error occurring during a call defined in this crate
#[non_exhaustive]
#[derive(thiserror::Error, Debug, strum::IntoStaticStr)]
pub enum NixInstallerError {
/// An error originating from an [`Action`](crate::action::Action)

View file

@ -270,6 +270,7 @@ impl BuiltinPlanner {
}
/// An error originating from a [`Planner`]
#[non_exhaustive]
#[derive(thiserror::Error, Debug, strum::IntoStaticStr)]
pub enum PlannerError {
/// `nix-installer` does not have a default planner for the target architecture right now

View file

@ -269,8 +269,9 @@ impl Into<BuiltinPlanner> for SteamDeck {
}
}
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
enum SteamDeckError {
pub enum SteamDeckError {
#[error("`{0}` is not a path that can be canonicalized into an absolute path, bind mounts require an absolute path")]
AbsolutePathRequired(PathBuf),
}

View file

@ -561,6 +561,7 @@ impl InitSettings {
}
/// An error originating from a [`Planner::settings`](crate::planner::Planner::settings)
#[non_exhaustive]
#[derive(thiserror::Error, Debug)]
pub enum InstallSettingsError {
/// `nix-installer` does not support the architecture right now