pub fn set_error(
req: &mut Msg,
error_code: i32,
dyn_error_code: DynErrorCode,
) -> boolExpand description
Mark req as in-error with error_code (a libc errno-shaped
value) and the matching dyn_error_code. The flag is set so the
response path can synthesise an error reply on the next pass.
Returns true when the message transitions from healthy to
error; subsequent calls are no-ops.
ยงExamples
use dynomite::msg::{request, DynErrorCode, Msg, MsgType};
let mut req = Msg::new(1, MsgType::ReqRedisGet, true);
assert!(request::set_error(&mut req, 13, DynErrorCode::PeerHostDown));
assert!(req.flags().is_error);
assert!(!request::set_error(&mut req, 13, DynErrorCode::PeerHostDown));