Add function to create Error from message String

This commit is contained in:
2026-06-23 21:24:21 -04:00
parent e38fa9ac0e
commit 1b8d382906

View File

@@ -74,6 +74,12 @@ impl Error {
}
}
/// Creates a new basic `Error` at this location with the given message
#[track_caller]
pub fn message_here<S: Into<String>>(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<String>) -> Self {