forked from Orchid/orchid
October commit
- custom parser support and infra - type-tagging and traits (untested) - match expressions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::fmt::Display;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::foreign::ExternError;
|
||||
use crate::foreign::{ExternError, XfnResult};
|
||||
|
||||
/// Some external event prevented the operation from succeeding
|
||||
#[derive(Clone)]
|
||||
@@ -13,15 +13,15 @@ pub struct RuntimeError {
|
||||
impl RuntimeError {
|
||||
/// Construct, upcast and wrap in a Result that never succeeds for easy
|
||||
/// short-circuiting
|
||||
pub fn fail<T>(
|
||||
message: String,
|
||||
operation: &'static str,
|
||||
) -> Result<T, Rc<dyn ExternError>> {
|
||||
pub fn fail<T>(message: String, operation: &'static str) -> XfnResult<T> {
|
||||
Err(Self { message, operation }.into_extern())
|
||||
}
|
||||
|
||||
/// Construct and upcast to [ExternError]
|
||||
pub fn ext(message: String, operation: &'static str) -> Rc<dyn ExternError> {
|
||||
pub fn ext(
|
||||
message: String,
|
||||
operation: &'static str,
|
||||
) -> Arc<dyn ExternError> {
|
||||
Self { message, operation }.into_extern()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user