You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![no_std]use soroban_sdk::{contract, contracterror, contractimpl, log,Env};#[contracterror]#[derive(Copy,Clone,Debug,Eq,PartialEq,PartialOrd,Ord)]#[repr(u32)]pubenumError{Bazz = 1,}#[contract]pubstructErrorContracts;#[contractimpl]implErrorContracts{pubfnerror_enum(env:Env) -> Result<u32,Error>{log!(&env,"Error from an enum");returnErr(Error::Bazz);}pubfnpanic(env:Env) -> Result<u32,Error>{panic!("Error from a panic")}pubfnexpect(env:Env) -> Result<u32,Error>{let _ = None::<i32>.expect("Error from expect");Ok(5u32)}}
currently the error messages that we get from the 3 different calls are as follows:
take this sample contract:
currently the error messages that we get from the 3 different calls are as follows:
error_enum
:panic
:expect
:We should sweep through our codebase and make sure we are using Error enums, instead of panic or expecting
The text was updated successfully, but these errors were encountered: