luadec/
error.rs

1use thiserror::Error;
2use std::io;
3
4/// Errors that can occur during Lua bytecode decompilation
5#[derive(Error, Debug)]
6pub enum DecompileError {
7    #[error("Invalid bytecode: {0}")]
8    InvalidBytecode(String),
9    
10    #[error("Failed to create Lua state")]
11    LuaStateCreationFailed,
12    
13    #[error("Failed to load bytecode: {0}")]
14    LoadFailed(String),
15    
16    #[error("Decompilation failed: {0}")]
17    DecompilationFailed(String),
18    
19    #[error("Internal error: {0}")]
20    InternalError(String),
21    
22    #[error("Null pointer error")]
23    NullPointer,
24    
25    #[error("I/O error: {0}")]
26    Io(#[from] io::Error),
27}
28
29pub type Result<T> = std::result::Result<T, DecompileError>;