Struct concordium_std::ParseError [−][src]
pub struct ParseError {}
Expand description
Zero-sized type to represent an error when reading bytes and deserializing.
When using custom error types in your smart contract, it is convenient to
implement the trait From<ParseError>
for you custom error type, to allow
using the ?
operator when deserializing bytes, such as the contract state
or parameters.
ⓘ
enum MyCustomReceiveError {
Parsing
}
impl From<ParseError> for MyCustomReceiveError {
fn from(_: ParseError) -> Self { MyCustomReceiveError::ParseParams }
}
#[receive(contract = "mycontract", name="some_receive_name")]
fn contract_receive<R: HasReceiveContext, L: HasLogger, A: HasActions>(
ctx: &R,
receive_amount: Amount,
logger: &mut L,
state: &mut State,
) -> Result<A, MyCustomReceiveError> {
...
let msg: MyParameterType = ctx.parameter_cursor().get()?;
...
}