aboutsummaryrefslogtreecommitdiff
path: root/src/gateway/error.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-06-07 15:01:47 -0700
committerZeyla Hellyer <[email protected]>2017-06-07 15:01:47 -0700
commit8f8a05996c5b47ec9401aabb517d96ed2af5c36b (patch)
treeab48c3b558c396f4f6d12c98a466074f97f17acf /src/gateway/error.rs
parentWs read/write timeout after 90s (diff)
downloadserenity-8f8a05996c5b47ec9401aabb517d96ed2af5c36b.tar.xz
serenity-8f8a05996c5b47ec9401aabb517d96ed2af5c36b.zip
Upgrade rust-websocket, rust-openssl, and hyper
Upgrade `rust-websocket` to v0.20, maintaining use of its sync client. This indirectly switches from `rust-openssl` v0.7 - which required openssl-1.0 on all platforms - to `native-tls`, which allows for use of schannel on Windows, Secure Transport on OSX, and openssl-1.1 on other platforms. Additionally, since hyper is no longer even a dependency of rust-websocket, we can safely and easily upgrade to `hyper` v0.10 and `multipart` v0.12. This commit is fairly experimental as it has not been tested on a long-running bot.
Diffstat (limited to 'src/gateway/error.rs')
-rw-r--r--src/gateway/error.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gateway/error.rs b/src/gateway/error.rs
index 57fa1cf..374c4a3 100644
--- a/src/gateway/error.rs
+++ b/src/gateway/error.rs
@@ -1,5 +1,6 @@
use std::error::Error as StdError;
use std::fmt::{self, Display};
+use websocket::message::CloseData;
/// An error that occurred while attempting to deal with the gateway.
///
@@ -10,9 +11,11 @@ pub enum Error {
/// There was an error building a URL.
BuildingUrl,
/// The connection closed, potentially uncleanly.
- Closed(Option<u16>, String),
+ Closed(Option<CloseData>),
/// Expected a Hello during a handshake
ExpectedHello,
+ /// When there was an error sending a heartbeat.
+ HeartbeatFailed,
/// Expected a Ready or an InvalidateSession
InvalidHandshake,
/// An indicator that an unknown opcode was received from the gateway.
@@ -33,8 +36,9 @@ impl StdError for Error {
fn description(&self) -> &str {
match *self {
Error::BuildingUrl => "Error building url",
- Error::Closed(_, _) => "Connection closed",
+ Error::Closed(_) => "Connection closed",
Error::ExpectedHello => "Expected a Hello",
+ Error::HeartbeatFailed => "Failed sending a heartbeat",
Error::InvalidHandshake => "Expected a valid Handshake",
Error::InvalidOpCode => "Invalid OpCode",
Error::NoSessionId => "No Session Id present when required",