aboutsummaryrefslogtreecommitdiff
path: root/src/constants.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-06-21 13:57:55 -0700
committerZeyla Hellyer <[email protected]>2017-06-21 13:57:55 -0700
commitf86be081e2681bcf003332fde5d47c727143ddb8 (patch)
tree30e6b7d54b394f979554375a1d3cfdf1a87f4c22 /src/constants.rs
parentAdd 'wait' parameter to http::execute_webhook (diff)
downloadserenity-f86be081e2681bcf003332fde5d47c727143ddb8.tar.xz
serenity-f86be081e2681bcf003332fde5d47c727143ddb8.zip
Extract Discord close codes to constants
Diffstat (limited to 'src/constants.rs')
-rw-r--r--src/constants.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/constants.rs b/src/constants.rs
index 148b348..1d4ec88 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -121,3 +121,50 @@ impl VoiceOpCode {
}
}
}
+
+pub mod close_codes {
+ /// Unknown error; try reconnecting?
+ ///
+ /// Can reconnect.
+ pub const UNKNOWN_ERROR: u16 = 4000;
+ /// Invalid Gateway OP Code.
+ ///
+ /// Can resume.
+ pub const UNKNOWN_OPCODE: u16 = 4001;
+ /// An invalid payload was sent.
+ ///
+ /// Can resume.
+ pub const DECODE_ERROR: u16 = 4002;
+ /// A payload was sent prior to identifying.
+ ///
+ /// Cannot reconnect.
+ pub const NOT_AUTHENTICATED: u16 = 4003;
+ /// The account token sent with the identify payload was incorrect.
+ ///
+ /// Cannot reconnect.
+ pub const AUTHENTICATION_FAILED: u16 = 4004;
+ /// More than one identify payload was sent.
+ ///
+ /// Can reconnect.
+ pub const ALREADY_AUTHENTICATED: u16 = 4005;
+ /// The sequence sent when resuming the session was invalid.
+ ///
+ /// Can reconnect.
+ pub const INVALID_SEQUENCE: u16 = 4007;
+ /// Payloads were being sent too quickly.
+ ///
+ /// Can resume.
+ pub const RATE_LIMITED: u16 = 4008;
+ /// A session timed out.
+ ///
+ /// Can reconnect.
+ pub const SESSION_TIMEOUT: u16 = 4009;
+ /// An invalid shard when identifying was sent.
+ ///
+ /// Cannot reconnect.
+ pub const INVALID_SHARD: u16 = 4010;
+ /// The session would have handled too many guilds.
+ ///
+ /// Cannot reconnect.
+ pub const SHARDING_REQUIRED: u16 = 4011;
+}