betex 0.4.0

Betfair / Prediction Market Exchange
Documentation
//! Book error types.

use super::protocol::reject::RejectReason;
use crate::types::CorrelationId;
use thiserror::Error;

/// Error returned when a book command is rejected.
#[derive(Debug, Error, Clone, PartialEq, Eq)]
#[error("book command rejected: {reason}")]
pub struct BookError {
    pub correlation_id: CorrelationId,
    pub reason: RejectReason,
}

impl BookError {
    pub fn new(correlation_id: CorrelationId, reason: RejectReason) -> Self {
        Self {
            correlation_id,
            reason,
        }
    }
}