From 7045481fae69150eea84983a55b762ecfaa04e2f Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 18 Jan 2025 21:58:49 +0000 Subject: [PATCH] add from_errno construction to Error Signed-off-by: Jason Volk --- src/core/error/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/error/mod.rs b/src/core/error/mod.rs index 2468811e..88ac6d09 100644 --- a/src/core/error/mod.rs +++ b/src/core/error/mod.rs @@ -131,6 +131,10 @@ pub enum Error { } impl Error { + #[inline] + #[must_use] + pub fn from_errno() -> Self { Self::Io(std::io::Error::last_os_error()) } + //#[deprecated] pub fn bad_database(message: &'static str) -> Self { crate::err!(Database(error!("{message}")))