use crate::rfc5389::attributes::ErrorCode;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TryAlternate;
impl TryAlternate {
pub const CODEPOINT: u16 = 300;
}
impl From<TryAlternate> for ErrorCode {
fn from(_: TryAlternate) -> Self {
ErrorCode::new(TryAlternate::CODEPOINT, "Try Alternate".to_owned()).expect("never fails")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct BadRequest;
impl BadRequest {
pub const CODEPOINT: u16 = 400;
}
impl From<BadRequest> for ErrorCode {
fn from(_: BadRequest) -> Self {
ErrorCode::new(BadRequest::CODEPOINT, "Bad Request".to_owned()).expect("never fails")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Unauthorized;
impl Unauthorized {
pub const CODEPOINT: u16 = 401;
}
impl From<Unauthorized> for ErrorCode {
fn from(_: Unauthorized) -> Self {
ErrorCode::new(Unauthorized::CODEPOINT, "Unauthorized".to_owned()).expect("never fails")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct UnknownAttribute;
impl UnknownAttribute {
pub const CODEPOINT: u16 = 420;
}
impl From<UnknownAttribute> for ErrorCode {
fn from(_: UnknownAttribute) -> Self {
ErrorCode::new(UnknownAttribute::CODEPOINT, "Unknown Attribute".to_owned())
.expect("never fails")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct StaleNonce;
impl StaleNonce {
pub const CODEPOINT: u16 = 438;
}
impl From<StaleNonce> for ErrorCode {
fn from(_: StaleNonce) -> Self {
ErrorCode::new(StaleNonce::CODEPOINT, "Stale Nonce".to_owned()).expect("never fails")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ServerError;
impl ServerError {
pub const CODEPOINT: u16 = 500;
}
impl From<ServerError> for ErrorCode {
fn from(_: ServerError) -> Self {
ErrorCode::new(ServerError::CODEPOINT, "Server Error".to_owned()).expect("never fails")
}
}