Function broker_code
pub fn broker_code(status: &Status) -> Option<u32>Expand description
The five-digit T-Invest error code of a status (80007, 30261), if the broker sent one.
T-Bank puts the number in the status message and the text in the message header. The number is
read from the start of either one, so both layouts work.
§Examples
use brokapi_tbank::error::broker_code;
use tonic::Status;
assert_eq!(broker_code(&Status::resource_exhausted("80007")), Some(80007));
assert_eq!(broker_code(&Status::resource_exhausted(" 80007: limit")), Some(80007));
assert_eq!(broker_code(&Status::resource_exhausted("mock failure")), None);