use crate::RmError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum XaError {
#[error("Error was caused by one or multiple Resource Manager Errors")]
RmErrors(Vec<RmError>),
#[error("Error was caused by wrong methods calls (wrong state, or wrong parameters)")]
Usage(&'static str),
#[error("Error was caused by wrong methods calls (wrong state, or wrong parameters)")]
UsageDetails(String),
#[error("Some resource managers responded with unexpected errors")]
Inconsistency(String, Vec<RmError>),
#[error("Reading an XaTransactionId from a byte stream failed")]
ReadXid(String),
}
impl From<std::io::Error> for XaError {
fn from(e: std::io::Error) -> XaError {
XaError::ReadXid(e.to_string())
}
}