#![allow(missing_docs)]
use crate::ResultCode;
error_chain! {
foreign_links {
Base64(::base64::DecodeError)
#[doc = "Error decoding Base64 encoded value"];
InvalidUtf8(::std::str::Utf8Error)
#[doc = "Error interpreting a sequence of u8 as a UTF-8 encoded string."];
Io(::std::io::Error)
#[doc = "Error during an I/O operation"];
MpscRecv(::std::sync::mpsc::RecvError)
#[doc = "Error returned from the `recv` function on an MPSC `Receiver`"];
ParseAddr(::std::net::AddrParseError)
#[doc = "Error parsing an IP or socket address"];
ParseInt(::std::num::ParseIntError)
#[doc = "Error parsing an integer"];
PwHash(::pwhash::error::Error)
#[doc = "Error returned while hashing a password for user authentication"];
}
errors {
BadResponse(details: String) {
description("Bad Server Response")
display("Bad Server Response: {}", details)
}
Connection(details: String) {
description("Network Connection Issue")
display("Unable to communicate with server cluster: {}", details)
}
InvalidArgument(details: String) {
description("Invalid Argument")
display("Invalid argument: {}", details)
}
InvalidNode(details: String) {
description("Invalid cluster node")
display("Invalid cluster node: {}", details)
}
NoMoreConnections {
description("Too many connections")
display("Too many connections")
}
ServerError(rc: ResultCode) {
description("Server Error")
display("Server error: {}", rc.into_string())
}
UdfBadResponse(details: String) {
description("UDF Bad Response")
display("UDF Bad Response: {}", details)
}
Timeout(details: String) {
description("Timeout")
display("Timeout: {}", details)
}
}
}
macro_rules! log_error_chain {
($err:expr, $($arg:tt)*) => {
error!($($arg)*);
error!("Error: {}", $err);
for e in $err.iter().skip(1) {
error!("caused by: {}", e);
}
if let Some(backtrace) = $err.backtrace() {
error!("backtrace: {:?}", backtrace);
}
};
}