casper_types/system/
error.rs1use core::fmt::{self, Display, Formatter};
2
3use crate::system::{auction, handle_payment, mint};
4
5#[derive(Debug, Copy, Clone)]
7#[non_exhaustive]
8pub enum Error {
9 Mint(mint::Error),
11 HandlePayment(handle_payment::Error),
13 Auction(auction::Error),
15}
16
17impl From<mint::Error> for Error {
18 fn from(error: mint::Error) -> Error {
19 Error::Mint(error)
20 }
21}
22
23impl From<handle_payment::Error> for Error {
24 fn from(error: handle_payment::Error) -> Error {
25 Error::HandlePayment(error)
26 }
27}
28
29impl From<auction::Error> for Error {
30 fn from(error: auction::Error) -> Error {
31 Error::Auction(error)
32 }
33}
34
35impl Display for Error {
36 fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
37 match self {
38 Error::Mint(error) => write!(formatter, "Mint error: {}", error),
39 Error::HandlePayment(error) => write!(formatter, "HandlePayment error: {}", error),
40 Error::Auction(error) => write!(formatter, "Auction error: {}", error),
41 }
42 }
43}