Skip to content

Commit

Permalink
feat(error): Allow removing context from errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo committed Dec 4, 2023
1 parent 95d411d commit 7e65f3e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions clap_builder/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ impl<F: ErrorFormatter> Error<F> {
self.inner.context.insert(kind, value)
}

/// remove a piece of context
#[inline(never)]
#[cfg(feature = "error-context")]
pub fn remove(&mut self, kind: ContextKind) -> Option<ContextValue> {
self.inner.context.remove(&kind)
}

/// Should the message be written to `stdout` or not?
#[inline]
pub fn use_stderr(&self) -> bool {
Expand Down

0 comments on commit 7e65f3e

Please sign in to comment.