#[derive(Debug, PartialEq, Eq, Clone)]
pub enum ClientError {
+ Auth(AuthError), // message
InternalError(String), // message
UrlParseError(String, String), // url, message
UrlError(String, String), // url, message
}
+impl From<AuthError> for ClientError {
+ fn from(err: AuthError) -> Self { ClientError::Auth(err) }
+}
+
impl From<reqwest::Error> for ClientError {
fn from(err: reqwest::Error) -> Self {
match err.url() {
Result<(), std::fmt::Error>
{
match self {
+ ClientError::Auth(ref autherr) =>
+ write!(f, "unable to read authentication: {}", autherr),
ClientError::InternalError(ref msg) =>
write!(f, "internal failure: {}", msg),
ClientError::UrlParseError(ref url, ref msg) =>
}
impl Client {
- pub fn new(cfgloc: &ConfigLocation) -> Result<Self, AuthError> {
+ pub fn new(cfgloc: &ConfigLocation) -> Result<Self, ClientError> {
Ok(Client {
auth: AuthConfig::load(cfgloc)?,
client: reqwest::blocking::Client::new(),
use super::menu::*;
use super::file::*;
use super::editor::*;
-use super::auth::AuthError;
fn ratatui_style_from_colour(colour: char) -> Style {
match colour {
}
}
}
-impl From<AuthError> for TuiError {
- fn from(err: AuthError) -> Self {
- TuiError {
- message: format!("unable to read authentication: {}", err),
- }
- }
-}
impl From<ClientError> for TuiError {
fn from(err: ClientError) -> Self {
TuiError {