Skip to main content

assert_err_code

Function assert_err_code 

Source
pub fn assert_err_code<R>(err: &StructError<R>, code: &str)
Expand description

Assert that the error’s stable code string matches.

This asserts ErrorIdentityProvider::stable_code, not the numeric [ErrorCode::error_code]. For numeric assertions, call .error_code() directly.

§Example

use orion_error::UnifiedReason;
use orion_error::dev::testing::assert_err_code;
use orion_error::StructError;

let err = StructError::from(UnifiedReason::system_error());
assert_err_code(&err, "sys.io_error");