Skip to content

Commit 72a2e06

Browse files
committed
Add comments about 'secondary_error'
1 parent 95edbe4 commit 72a2e06

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

soroban-env-host/src/host/error.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,16 @@ impl Host {
254254
/// enriches the returned [Error] with [DebugInfo] in the form of a
255255
/// [Backtrace] and snapshot of the [Events] buffer.
256256
pub(crate) fn error(&self, error: Error, msg: &str, args: &[Val]) -> HostError {
257+
// Note that though we are calling `secondary_error`, this is likely the
258+
// "primary" error and this call is an implementation detail to generate
259+
// the initial backtrace.
257260
self.secondary_error(HostError::from(error), msg, args)
258261
}
259262

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

0 commit comments

Comments
 (0)