mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
impl Error for Exceptions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::fmt;
|
||||
use std::{error::Error, fmt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Exceptions {
|
||||
@@ -7,13 +7,42 @@ pub enum Exceptions {
|
||||
IllegalStateException(String),
|
||||
ArithmeticException(String),
|
||||
NotFoundException(String),
|
||||
FormatException(String),
|
||||
ChecksumException(String),
|
||||
FormatException(String),
|
||||
ChecksumException(String),
|
||||
ReaderException(String),
|
||||
WriterException(String),
|
||||
ReedSolomonException(String),
|
||||
IndexOutOfBoundsException(String),
|
||||
RuntimeException(String),
|
||||
ParseException(String),
|
||||
ReaderDecodeException()
|
||||
}
|
||||
ReaderDecodeException(),
|
||||
}
|
||||
|
||||
impl fmt::Display for Exceptions {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Exceptions::IllegalArgumentException(a) => {
|
||||
write!(f, "IllegalArgumentException - {}", a)
|
||||
}
|
||||
Exceptions::UnsupportedOperationException(a) => {
|
||||
write!(f, "UnsupportedOperationException - {}", a)
|
||||
}
|
||||
Exceptions::IllegalStateException(a) => write!(f, "IllegalStateException - {}", a),
|
||||
Exceptions::ArithmeticException(a) => write!(f, "ArithmeticException - {}", a),
|
||||
Exceptions::NotFoundException(a) => write!(f, "NotFoundException - {}", a),
|
||||
Exceptions::FormatException(a) => write!(f, "FormatException - {}", a),
|
||||
Exceptions::ChecksumException(a) => write!(f, "ChecksumException - {}", a),
|
||||
Exceptions::ReaderException(a) => write!(f, "ReaderException - {}", a),
|
||||
Exceptions::WriterException(a) => write!(f, "WriterException - {}", a),
|
||||
Exceptions::ReedSolomonException(a) => write!(f, "ReedSolomonException - {}", a),
|
||||
Exceptions::IndexOutOfBoundsException(a) => {
|
||||
write!(f, "IndexOutOfBoundsException - {}", a)
|
||||
}
|
||||
Exceptions::RuntimeException(a) => write!(f, "RuntimeException - {}", a),
|
||||
Exceptions::ParseException(a) => write!(f, "ParseException - {}", a),
|
||||
Exceptions::ReaderDecodeException() => write!(f, "ReaderDecodeException - -"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for Exceptions {}
|
||||
|
||||
Reference in New Issue
Block a user