pub struct OlError {
pub code: &'static str,
pub message: String,
pub suggestion: Option<String>,
pub docs_url: Option<String>,
}Expand description
A structured, user-facing error with an OL-XXXX code.
§Display format (D-06/D-07)
Error: {message} (OL-XXXX)
Suggestion: {actionable text}
Docs: {url}Fields§
§code: &'static strThe OL-XXXX error code (e.g. “OL-1001”).
message: StringHuman-readable, actionable error description.
suggestion: Option<String>Optional suggestion for how to fix the error.
docs_url: Option<String>Optional link to documentation for this error code.
Implementations§
Source§impl OlError
impl OlError
Sourcepub fn new(code: &'static str, message: impl Into<String>) -> Self
pub fn new(code: &'static str, message: impl Into<String>) -> Self
Create a new error with the given code and message.
Sourcepub fn with_suggestion(self, s: impl Into<String>) -> Self
pub fn with_suggestion(self, s: impl Into<String>) -> Self
Attach a suggestion to this error.
Sourcepub fn bug_report(message: impl Into<String>) -> Self
pub fn bug_report(message: impl Into<String>) -> Self
Build a “bug report” error pre-filled with a GitHub issue URL.
Use this for unexpected internal errors that indicate a bug in openlatch.
Trait Implementations§
Source§impl Error for OlError
impl Error for OlError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for OlError
impl RefUnwindSafe for OlError
impl Send for OlError
impl Sync for OlError
impl Unpin for OlError
impl UnsafeUnpin for OlError
impl UnwindSafe for OlError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.