#[error]Expand description
Chain extension error.
§Description
Using #[obce::error] you can generate custom chain extension
errors.
Errors marked with #[obce::error] have Debug, Copy, Clone, PartialEq, Eq, scale::Encode and scale::Decode
automatically derived for them.
#[obce::error]
enum Error {
FirstError,
SecondError(u32)
}§Critical errors
#[obce::error] can automatically generate SupportCriticalError
implementation for variant that you mark with #[obce(critical)]:
use obce::substrate::CriticalError;
#[obce::error]
enum Error {
FirstError,
#[obce(critical)]
Two(CriticalError)
}Only one enum variant can be marked as #[obce(critical)].
§RetVal-convertible errors
You can mark error variants with #[obce(ret_val = "...")] to create an implementation of
TryFrom<YourError> for pallet_contracts::chain_extension::RetVal,
which will automatically convert suitable error variants to RetVal on implementation methods marked with #[obce(ret_val)].
Error variant’s #[obce(ret_val = "...")] accepts an expression that evaluates to u32:
#[obce::error]
enum Error {
#[obce(ret_val = "10_001")]
First,
Second
}