use quick_error::*;
use url::ParseError;
use crate::common::*;
use crate::serializer::SerializerError;
use crate::transport::TransportError;
quick_error! {
#[derive(Debug)]
pub enum WampError {
UnknownError(e: String) {
from()
display("Unhandled error : {}", e)
}
ConnectionError(e: TransportError) {
from()
source(e)
display("An error occured with the connection: ({})", e)
}
SerializationError(e: SerializerError) {
from()
source(e)
display("An error occured while [de]serializing a message: ({})", e)
}
InvalidUri(e: ParseError) {
source(e)
display("The uri provided could not be parsed: {}", e)
}
NoHostInUri {
display("The uri provided did not contain a host address")
}
ProtocolError(e: String) {
display("An unexpected WAMP message was received: {}", e)
}
ClientDied {
display("The client has exited without sending Shutdown")
}
RequestIdCollision {
display("There was a collision with a unique request id")
}
ServerError(uri: String, details: WampDict) {
context(uri: String, details: WampDict) -> (uri, details)
display("The server returned an error: {} {:?}", uri, details)
}
}
}