impl fmt::Display for LinkError
@@ -11,6 +11,7 @@ use enclose::enclose;
use futures::{future, FutureExt, TryFutureExt};
use serde::Serialize;
use std::convert::TryFrom;
+use std::fmt;
#[derive(Clone, PartialEq, From, Serialize)]
#[cfg_attr(debug_assertions, derive(Debug))]
@@ -21,6 +22,16 @@ pub enum LinkError {
UnexpectedResponse(String),
}
+impl fmt::Display for LinkError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match &self {
+ LinkError::API(error) => write!(f, "API: {}", error.message),
+ LinkError::Env(error) => write!(f, "Env: {}", error.message()),
+ LinkError::UnexpectedResponse(message) => write!(f, "UnexpectedResponse: {}", message),
+ }
+ }
+}
+
#[derive(Derivative, Serialize)]
#[derivative(Default(bound = ""))]
#[serde(rename_all = "camelCase")]
