Struct ConvertError
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§
§impl ConvertError
impl ConvertError
pub fn new(user_message: impl Into<String>) -> ConvertError
pub fn new(user_message: impl Into<String>) -> ConvertError
Construct with a user-defined message.
If you don’t need a custom message, consider using ConvertError::default()
instead.
pub fn with_error<E>(error: E) -> ConvertError
pub fn with_error<E>(error: E) -> ConvertError
Create a new custom error wrapping an Error
.
pub fn with_error_value<E, V>(error: E, value: V) -> ConvertError
pub fn with_error_value<E, V>(error: E, value: V) -> ConvertError
Create a new custom error wrapping an Error
and the value that failed to convert.
pub fn cause(&self) -> Option<&(dyn Error + Sync + Send + 'static)>
pub fn cause(&self) -> Option<&(dyn Error + Sync + Send + 'static)>
Returns the rust-error that caused this error, if one exists.
pub fn value(&self) -> Option<&Variant>
pub fn value(&self) -> Option<&Variant>
Returns a reference of the value that failed to convert, if one exists.
pub 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§
§impl Debug for ConvertError
impl Debug for ConvertError
§impl Default for ConvertError
impl Default for ConvertError
§fn default() -> ConvertError
fn default() -> ConvertError
Create a custom error, without any description.
If you need a custom message, consider using ConvertError::new("message")
instead.