[][src]Macro ironmq_codec::frame_error

macro_rules! frame_error {
    ($code:expr, $message:expr) => { ... };
}

Shorthand for making errors with error code and error message.

use ironmq_codec::frame_error;
use ironmq_codec::FrameError;
use ironmq_codec::frame::AMQPValue;

fn as_string(val: AMQPValue) -> Result<String, Box<dyn std::error::Error>> {
    if let AMQPValue::SimpleString(s) = val {
        return Ok(s.clone())
    }

    frame_error!(10, "Value cannot be converted to string")
}