pub enum GaiaErrorKind {
Show 16 variants
InvalidInstruction {
instruction: String,
architecture: Architecture,
},
UnsupportedArchitecture {
architecture: Architecture,
},
InvalidRange {
length: usize,
expect: usize,
},
IoError {
io_error: Error,
url: Option<Url>,
},
SyntaxError {
message: String,
location: SourceLocation,
},
StageError {
location: Location<'static>,
},
NotImplemented {
feature: String,
},
UnsupportedFeature {
feature: String,
location: SourceLocation,
},
CustomError {
message: String,
},
AdapterError {
adapter_name: String,
message: String,
source: Option<Box<GaiaError>>,
},
PlatformUnsupported {
platform: String,
operation: String,
},
ConfigError {
config_path: Option<String>,
message: String,
},
UnsupportedTarget {
target: CompilationTarget,
},
CompilationFailed {
target: CompilationTarget,
message: String,
},
UnreachableError {
location: Location<'static>,
},
SaveError {
format: String,
message: String,
},
}Expand description
Gaia 错误种类枚举,定义了所有可能的错误类型
Variants§
InvalidInstruction
无效指令错误,当解析到未知或不支持的指令时使用
UnsupportedArchitecture
不支持的架构错误,当尝试在不支持的架构上执行操作时使用
Fields
§
architecture: Architecture不支持的架构
InvalidRange
无效范围错误,当实际长度与期望长度不匹配时使用
这种错误通常发生在解析二进制数据或验证数据结构时, 当实际数据长度与期望的长度不符时抛出此错误。
IoError
IO 错误,包含底层的 IO 错误和可选的 URL 信息
当文件读写、网络请求等 IO 操作失败时使用
Fields
SyntaxError
语法错误,包含错误消息和源代码位置信息
当解析源代码发现语法问题时使用,提供详细的错误位置信息
Fields
§
location: SourceLocation错误发生的源代码位置信息
包含了错误所在的文件、行号、列号等位置信息, 帮助开发者快速定位问题。
StageError
停止运行
NotImplemented
功能未实现错误
当调用尚未实现的功能时使用
UnsupportedFeature
不支持的功能错误
当尝试使用不支持的功能时使用
CustomError
自定义错误,包含自定义的错误消息
当需要表示特定业务逻辑错误或其他非标准错误时使用
AdapterError
适配器错误,当适配器操作失败时使用
包含适配器名称和具体的错误信息
PlatformUnsupported
平台不支持错误,当目标平台不支持某个操作时使用
包含平台名称和不支持的操作描述
ConfigError
配置错误,当配置文件解析或验证失败时使用
包含配置文件路径和错误信息
UnsupportedTarget
不支持的编译目标错误
当尝试编译到不支持的目标平台时使用
Fields
§
target: CompilationTarget不支持的编译目标
CompilationFailed
编译失败错误
当编译过程中发生错误时使用
UnreachableError
不可达错误,当程序执行到不可达的位置时使用
SaveError
保存错误,当保存文件失败时使用
包含保存格式和错误消息
Trait Implementations§
Source§impl Debug for GaiaErrorKind
impl Debug for GaiaErrorKind
Source§impl Display for GaiaErrorKind
为GaiaErrorKind实现Display trait
impl Display for GaiaErrorKind
为GaiaErrorKind实现Display trait
提供用户友好的错误信息输出格式
Source§impl From<GaiaErrorKind> for GaiaError
将GaiaErrorKind转换为GaiaError的实现
impl From<GaiaErrorKind> for GaiaError
将GaiaErrorKind转换为GaiaError的实现
这个转换会自动将错误种类包装到Box中, 这是GaiaError结构体所要求的,可以减少内存占用
Source§fn from(error: GaiaErrorKind) -> Self
fn from(error: GaiaErrorKind) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for GaiaErrorKind
impl !RefUnwindSafe for GaiaErrorKind
impl Send for GaiaErrorKind
impl Sync for GaiaErrorKind
impl Unpin for GaiaErrorKind
impl !UnwindSafe for GaiaErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more