pub struct ConvertError { /* private fields */ }
Expand description
Represents errors that can occur when converting values from Godot.
To create user-defined errors, you can use ConvertError::default()
or ConvertError::new("message")
.
Implementations§
Source§impl ConvertError
impl ConvertError
Sourcepub fn new(user_message: impl Into<String>) -> Self
pub fn new(user_message: impl Into<String>) -> Self
Construct with a user-defined message.
If you don’t need a custom message, consider using ConvertError::default()
instead.
Sourcepub fn with_error<E>(error: E) -> Self
pub fn with_error<E>(error: E) -> Self
Create a new custom error wrapping an Error
.
Sourcepub fn with_error_value<E, V>(error: E, value: V) -> Self
pub fn with_error_value<E, V>(error: E, value: V) -> Self
Create a new custom error wrapping an Error
and the value that failed to convert.
Sourcepub fn cause(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
pub fn cause(&self) -> Option<&(dyn Error + Send + Sync + 'static)>
Returns the rust-error that caused this error, if one exists.
Sourcepub fn value(&self) -> Option<&Variant>
pub fn value(&self) -> Option<&Variant>
Returns a reference of the value that failed to convert, if one exists.
Sourcepub fn into_erased(self) -> impl Error + Send + Sync
pub fn into_erased(self) -> impl Error + Send + Sync
Converts error into generic error type. It is useful to send error across thread. Do note that some data might get lost during conversion.
Trait Implementations§
Source§impl Debug for ConvertError
impl Debug for ConvertError
Source§impl Default for ConvertError
impl Default for ConvertError
Source§fn default() -> Self
fn default() -> Self
Create a custom error, without any description.
If you need a custom message, consider using ConvertError::new("message")
instead.