rust_releases_rust_dist_with_cli/
errors.rs

1use rust_releases_core::Channel;
2use std::io;
3
4/// A result type which binds the `RustDistWithCLIError` to the error type.
5pub type RustDistWithCLIResult<T> = Result<T, RustDistWithCLIError>;
6
7/// Top level failure cases for rust-releases-rust-dist-with-cli source crate
8#[derive(Debug, thiserror::Error)]
9#[non_exhaustive]
10pub enum RustDistWithCLIError {
11    /// Returned in case a `Channel` is not implemented for the Source
12    #[error("Channel {0} is not yet available for the 'RustDistWithCLI' source type")]
13    ChannelNotAvailable(Channel),
14
15    /// Returned in case of an `std::io::Error`.
16    #[error(transparent)]
17    Io(#[from] io::Error),
18
19    /// Returned in case the base cache dir could not be found.
20    #[error(transparent)]
21    BaseCacheDir(#[from] rust_releases_io::BaseCacheDirError),
22
23    /// Returned in case the input text could not be parsed
24    #[error(transparent)]
25    UnrecognizedText(#[from] std::str::Utf8Error),
26}