Skip to main content

GaiaErrorKind

Enum GaiaErrorKind 

Source
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

无效指令错误,当解析到未知或不支持的指令时使用

Fields

§instruction: String

无效的指令字符串

§architecture: Architecture

指令所属的架构

§

UnsupportedArchitecture

不支持的架构错误,当尝试在不支持的架构上执行操作时使用

Fields

§architecture: Architecture

不支持的架构

§

InvalidRange

无效范围错误,当实际长度与期望长度不匹配时使用

这种错误通常发生在解析二进制数据或验证数据结构时, 当实际数据长度与期望的长度不符时抛出此错误。

Fields

§length: usize

实际长度

表示实际测量或解析得到的数据长度。

§expect: usize

期望长度

表示根据规范或预期应该具有的长度。

§

IoError

IO 错误,包含底层的 IO 错误和可选的 URL 信息

当文件读写、网络请求等 IO 操作失败时使用

Fields

§io_error: Error

底层的 IO 错误

包含了具体的 IO 错误信息,如文件不存在、权限不足等。

§url: Option<Url>

与 IO 操作相关的 URL,可选

如果 IO 操作与特定文件或网络资源相关,这里存储其 URL。 可以是文件系统路径或网络地址。

§

SyntaxError

语法错误,包含错误消息和源代码位置信息

当解析源代码发现语法问题时使用,提供详细的错误位置信息

Fields

§message: String

错误消息,描述具体的语法问题

包含了人类可读的语法错误描述,如 “缺少分号”、“未闭合的括号” 等。

§location: SourceLocation

错误发生的源代码位置信息

包含了错误所在的文件、行号、列号等位置信息, 帮助开发者快速定位问题。

§

StageError

停止运行

Fields

§location: Location<'static>

停止运行的地方

§

NotImplemented

功能未实现错误

当调用尚未实现的功能时使用

Fields

§feature: String

未实现功能的描述

§

UnsupportedFeature

不支持的功能错误

当尝试使用不支持的功能时使用

Fields

§feature: String

不支持的功能描述

§location: SourceLocation

错误发生的源代码位置信息

§

CustomError

自定义错误,包含自定义的错误消息

当需要表示特定业务逻辑错误或其他非标准错误时使用

Fields

§message: String

自定义错误消息

§

AdapterError

适配器错误,当适配器操作失败时使用

包含适配器名称和具体的错误信息

Fields

§adapter_name: String

适配器名称

§message: String

错误消息

§source: Option<Box<GaiaError>>

可选的源错误

§

PlatformUnsupported

平台不支持错误,当目标平台不支持某个操作时使用

包含平台名称和不支持的操作描述

Fields

§platform: String

平台名称

§operation: String

不支持的操作描述

§

ConfigError

配置错误,当配置文件解析或验证失败时使用

包含配置文件路径和错误信息

Fields

§config_path: Option<String>

配置文件路径

§message: String

错误消息

§

UnsupportedTarget

不支持的编译目标错误

当尝试编译到不支持的目标平台时使用

Fields

§target: CompilationTarget

不支持的编译目标

§

CompilationFailed

编译失败错误

当编译过程中发生错误时使用

Fields

§target: CompilationTarget

编译目标

§message: String

错误消息

§

UnreachableError

不可达错误,当程序执行到不可达的位置时使用

Fields

§location: Location<'static>

不可达位置的源代码位置信息

§

SaveError

保存错误,当保存文件失败时使用

包含保存格式和错误消息

Fields

§format: String

保存格式

§message: String

错误消息

Trait Implementations§

Source§

impl Debug for GaiaErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for GaiaErrorKind

为GaiaErrorKind实现Display trait

提供用户友好的错误信息输出格式

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<GaiaErrorKind> for GaiaError

将GaiaErrorKind转换为GaiaError的实现

这个转换会自动将错误种类包装到Box中, 这是GaiaError结构体所要求的,可以减少内存占用

Source§

fn from(error: GaiaErrorKind) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,