From 1b8d38290634c481ddf009dfd4a49c1378817b88 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Tue, 23 Jun 2026 21:24:21 -0400 Subject: [PATCH] Add function to create Error from message String --- src/util/error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/error.rs b/src/util/error.rs index 5c9c7e6..61e9470 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -74,6 +74,12 @@ impl Error { } } + /// Creates a new basic `Error` at this location with the given message + #[track_caller] + pub fn message_here>(message: S) -> Self { + Error::new(ErrorType::Error(message.into()), ErrorLocation::here()) + } + /// Adds a context message to the error #[track_caller] pub fn with_context(mut self, context: impl Into) -> Self {