diff --git a/crates/cgp-core/src/prelude.rs b/crates/cgp-core/src/prelude.rs index 26385b45..e0faf58b 100644 --- a/crates/cgp-core/src/prelude.rs +++ b/crates/cgp-core/src/prelude.rs @@ -4,7 +4,10 @@ pub use cgp_component_macro::{ cgp_auto_getter, cgp_component, cgp_getter, cgp_preset, cgp_type, delegate_components, for_each_replace, replace_with, }; -pub use cgp_error::{CanRaiseError, CanWrapError, HasAsyncErrorType, HasErrorType}; +pub use cgp_error::{ + CanRaiseAsyncError, CanRaiseError, CanWrapAsyncError, CanWrapError, HasAsyncErrorType, + HasErrorType, +}; pub use cgp_field::{ Char, Cons, Either, FieldGetter, HasField, HasFieldMut, MutFieldGetter, Nil, UseField, Void, }; diff --git a/crates/cgp-error/src/lib.rs b/crates/cgp-error/src/lib.rs index c01dae80..77e51b16 100644 --- a/crates/cgp-error/src/lib.rs +++ b/crates/cgp-error/src/lib.rs @@ -3,6 +3,7 @@ mod traits; pub use traits::{ - CanRaiseError, CanWrapError, ErrorOf, ErrorRaiser, ErrorRaiserComponent, ErrorTypeComponent, - ErrorWrapper, ErrorWrapperComponent, HasAsyncErrorType, HasErrorType, ProvideErrorType, + CanRaiseAsyncError, CanRaiseError, CanWrapAsyncError, CanWrapError, ErrorOf, ErrorRaiser, + ErrorRaiserComponent, ErrorTypeComponent, ErrorWrapper, ErrorWrapperComponent, + HasAsyncErrorType, HasErrorType, ProvideErrorType, }; diff --git a/crates/cgp-error/src/traits/has_async_error_type.rs b/crates/cgp-error/src/traits/has_async_error_type.rs index d52421b4..d6ad25c1 100644 --- a/crates/cgp-error/src/traits/has_async_error_type.rs +++ b/crates/cgp-error/src/traits/has_async_error_type.rs @@ -1,7 +1,22 @@ use cgp_async::Async; use crate::traits::HasErrorType; +use crate::{CanRaiseError, CanWrapError}; pub trait HasAsyncErrorType: Async + HasErrorType {} impl HasAsyncErrorType for Context where Context: Async + HasErrorType {} + +pub trait CanRaiseAsyncError: HasAsyncErrorType + CanRaiseError {} + +impl CanRaiseAsyncError for Context where + Context: HasAsyncErrorType + CanRaiseError +{ +} + +pub trait CanWrapAsyncError: HasAsyncErrorType + CanWrapError {} + +impl CanWrapAsyncError for Context where + Context: HasAsyncErrorType + CanWrapError +{ +} diff --git a/crates/cgp-error/src/traits/mod.rs b/crates/cgp-error/src/traits/mod.rs index cc75e5af..cde6af2d 100644 --- a/crates/cgp-error/src/traits/mod.rs +++ b/crates/cgp-error/src/traits/mod.rs @@ -5,5 +5,5 @@ mod has_error_type; pub use can_raise_error::{CanRaiseError, ErrorRaiser, ErrorRaiserComponent}; pub use can_wrap_error::{CanWrapError, ErrorWrapper, ErrorWrapperComponent}; -pub use has_async_error_type::HasAsyncErrorType; +pub use has_async_error_type::{CanRaiseAsyncError, CanWrapAsyncError, HasAsyncErrorType}; pub use has_error_type::{ErrorOf, ErrorTypeComponent, HasErrorType, ProvideErrorType};