From 7d3ffe9b8d189f8bbec8a2c96b21d47689392b76 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 29 Jul 2020 09:28:59 +0200 Subject: [PATCH] add http_bail macro Signed-off-by: Wolfgang Bumiller --- proxmox/src/api/error.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proxmox/src/api/error.rs b/proxmox/src/api/error.rs index d152a250..fec36f2b 100644 --- a/proxmox/src/api/error.rs +++ b/proxmox/src/api/error.rs @@ -34,3 +34,11 @@ macro_rules! http_err { )) }}; } + +/// Bail with an error generated with the `http_err!` macro. +#[macro_export] +macro_rules! http_bail { + ($status:ident, $($fmt:tt)+) => {{ + return Err($crate::http_err!($status, $($fmt)+)); + }}; +}