[−][src]Struct glsp_engine::GError
The error type generated by GameLisp code.
GResult<T>
is an alias for Result<T, GError>
.
The easiest way to generate an error yourself is by using one of the macros
bail!
, ensure!
or error!
.
The macro-no-op
signal is represented by a special kind
of GError
which is not caught by try
or
try-verbose
. This means that in order to trigger a
macro_no_op!
, the enclosing function must return GResult<T>
.
The with_source
method can be used to chain together two GErrors
,
or to chain an arbitrary Error
type
onto a GError
.
Implementations
impl GError
[src]
pub fn new() -> GError
[src]
pub fn from_str(st: &str) -> GError
[src]
pub fn from_val<T: IntoVal>(t: T) -> GError
[src]
pub fn macro_no_op() -> GError
[src]
pub fn is_macro_no_op(&self) -> bool
[src]
Returns true
if this error was generated using macro_no_op!
or
GError::macro_no_op
.
pub fn val(&self) -> Val
[src]
Returns the error's payload. Panics if this error is a macro-no-op.
pub fn stack_trace(&self) -> Option<&str>
[src]
Returns the error's saved stack trace.
Errors invoked in a dynamic context where verbose errors are disabled (for example,
the dynamic scope of a try
form) will not have a
stack trace.
pub fn with_source(self, source_to_add: impl Error + 'static) -> GError
[src]
Chains another error onto this GError
.
This can be used to wrap arbitrary Error
types in a GError
.
let words = match fs::read_to_string("words.txt") { Ok(words) => words, Err(fs_err) => { return Err(error!("failed to open words.txt").with_source(fs_err)) } };
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for GError
[src]
impl !Send for GError
[src]
impl !Sync for GError
[src]
impl Unpin for GError
[src]
impl !UnwindSafe for GError
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,