Skip to content

Commit

Permalink
Add comments about 'secondary_error'
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Feb 26, 2024
1 parent 95edbe4 commit 37e2974
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions soroban-env-host/src/host/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,15 @@ impl Host {
/// enriches the returned [Error] with [DebugInfo] in the form of a
/// [Backtrace] and snapshot of the [Events] buffer.
pub(crate) fn error(&self, error: Error, msg: &str, args: &[Val]) -> HostError {
// Note that though we are calling `secondary_error`, this is likely the
// "primary" error and this call is an implementation detail
self.secondary_error(HostError::from(error), msg, args)
}

/// The same as [Host::error] but it will preserve the original
/// backtrace from `error` instead of generating a new one.
///
/// This is typically used to raise a new error when we already have an error.
pub(crate) fn secondary_error(&self, error: HostError, msg: &str, args: &[Val]) -> HostError {
let mut he = error;
self.with_debug_mode(|| {
Expand Down

0 comments on commit 37e2974

Please sign in to comment.