macro_rules! bail_on { ($err_state:expr, $val:expr) => { ... }; }
Checks if the value is equal to the error state, and if it is, uses the value of errno to create an error and return early.