diff options
| author | Austin Hellyer <[email protected]> | 2016-11-21 19:17:57 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-21 19:17:57 -0800 |
| commit | 6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078 (patch) | |
| tree | a6f0303ebcf4a474f603aaa5c8fff67409d42a17 /src/error.rs | |
| parent | Add support for creating embed images (diff) | |
| download | serenity-6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078.tar.xz serenity-6b1a83111d4d9cc2ef2f4eed1ee8f58d45525078.zip | |
Re-organize the client module
Re-organize the client module, creating a `gateway` submodule, and
splitting the connection into separate files in it.
The connection was a conglomeration of a number of purposes, most of
which are actually used elsewhere in the library and/or exposed to the
user. Thus, it makes sense to separate each item in a gateway-specific
module.
By splitting the client module further, this is a re-organization for
preliminary RPC support WRT the Client.
Additionally, rename the Connection struct to a Shard. The Connection
itself was not the actual connection, and was a higher-level interface
to the real connection logic. A Shard is a more accurate representation
of what it actually is.
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/error.rs b/src/error.rs index 84f4e04..8c442ec 100644 --- a/src/error.rs +++ b/src/error.rs @@ -5,7 +5,8 @@ use hyper::Error as HyperError; use serde_json::Error as JsonError; use serde_json::Value; use websocket::result::WebSocketError; -use ::client::{ClientError, ConnectionError}; +use ::client::gateway::GatewayError; +use ::client::ClientError; #[cfg(feature="voice")] use ::ext::voice::VoiceError; @@ -22,14 +23,14 @@ pub type Result<T> = ::std::result::Result<T, Error>; /// A common error enum returned by most of the library's functionality within a /// custom [`Result`]. /// -/// The most common error types, the [`ClientError`] and [`ConnectionError`] +/// The most common error types, the [`ClientError`] and [`GatewayError`] /// enums, are both wrapped around this in the form of the [`Client`] and -/// [`Connection`] variants. +/// [`Gateway`] variants. /// /// [`Client`]: #variant.Client /// [`ClientError`]: client/enum.ClientError.html -/// [`Connection`]: #variant.Connection -/// [`ConnectionError`]: client/enum.ConnectionError.html +/// [`Gateway`]: #variant.Gateway +/// [`GatewayError`]: client/enum.GatewayError.html /// [`Result`]: type.Result.html #[derive(Debug)] pub enum Error { @@ -38,10 +39,10 @@ pub enum Error { /// [client]: client/index.html /// [http]: client/http/index.html Client(ClientError), - /// An error with the WebSocket [`Connection`]. + /// An error with the WebSocket [`Gateway`]. /// - /// [`Connection`]: client/struct.Connection.html - Connection(ConnectionError), + /// [`Gateway`]: client/gateway/index.html + Gateway(GatewayError), /// An error while decoding a payload. Decode(&'static str, Value), /// An error from the `hyper` crate. @@ -107,7 +108,7 @@ impl StdError for Error { fn description(&self) -> &str { match *self { Error::Client(_) => "Client refused a request", - Error::Connection(ref _inner) => "Connection error", + Error::Gateway(ref _inner) => "Gateway error", Error::Decode(msg, _) | Error::Other(msg) => msg, Error::Hyper(ref inner) => inner.description(), Error::Io(ref inner) => inner.description(), |