class_rs/
errors.rs

1use std::fmt::Formatter;
2
3#[derive(Debug)]
4pub enum JavaError {
5    ConstantTypeError(String),
6    InvalidConstantId,
7    StringNotFound,
8}
9
10impl std::fmt::Display for JavaError {
11    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
12        match self {
13            JavaError::ConstantTypeError(message) => write!(f, "{}", message),
14            JavaError::InvalidConstantId => write!(f, "Invalid constant id"),
15            JavaError::StringNotFound => write!(f, "String not found"),
16        }
17    }
18}
19
20impl std::error::Error for JavaError {}