Pretty print error
@@ -12,9 +12,13 @@ pub type ClientResult<T> = Result<T, ClientError>;
impl Display for ClientError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ if f.alternate() {
+ write!(f, "{:#}", json!(self))
+ } else {
write!(f, "{}", self.message)
}
}
+}
impl std::error::Error for ClientError {}
