impl error for handshakeerror

This commit is contained in:
Rob Ede 2021-05-14 16:50:33 +01:00
parent 2a8c650f2c
commit ba9950d81c
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
2 changed files with 3 additions and 2 deletions

View File

@ -44,6 +44,7 @@ impl Error {
}
/// Errors that can generate responses.
// TODO: add std::error::Error bound when replacement for Box<dyn Error> is found
pub trait ResponseError: fmt::Debug + fmt::Display {
/// Returns appropriate status code for error.
///

View File

@ -25,7 +25,7 @@ pub use self::frame::Parser;
pub use self::proto::{hash_key, CloseCode, CloseReason, OpCode};
/// WebSocket protocol errors.
#[derive(Debug, Display, From, Error)]
#[derive(Debug, Display, Error, From)]
pub enum ProtocolError {
/// Received an unmasked frame from client.
#[display(fmt = "Received an unmasked frame from client.")]
@ -71,7 +71,7 @@ pub enum ProtocolError {
impl ResponseError for ProtocolError {}
/// WebSocket handshake errors
#[derive(PartialEq, Debug, Display)]
#[derive(Debug, PartialEq, Display, Error)]
pub enum HandshakeError {
/// Only get method is allowed.
#[display(fmt = "Method not allowed.")]