Skip to main content

map_order_cmd_err

Function map_order_cmd_err 

Source
pub fn map_order_cmd_err(err: BcsApiError) -> Error
Expand description

map_command_err for commands on an existing order. “Not found” is a definite refusal (Rejected, code not_found) in map_command_err already; this is the same mapping, kept for the code that calls it.

Used by cancel, replace and cancel_stop.

§Examples

use brokapi_bcs_protocol::error::BcsApiError;
use brokapi_bcs::error::map_order_cmd_err;
use brokapi_core::Error;

match map_order_cmd_err(BcsApiError::NotFound { trace_id: None }) {
    Error::Rejected { code, .. } => assert_eq!(code, "not_found"),
    other => panic!("{other:?}"),
}