Skip to content

Commit bbcac79

Browse files
fix: use custom errors for the runtime
Fixes #196
1 parent ca81f77 commit bbcac79

File tree

6 files changed

+216
-145
lines changed

6 files changed

+216
-145
lines changed

actors/runtime/src/builtin/shared.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use fvm_shared::address::Address;
66
use fvm_shared::METHOD_SEND;
77

88
use crate::runtime::Runtime;
9+
use anyhow::Context;
910

1011
pub const HAMT_BIT_WIDTH: u32 = 5;
1112

@@ -24,7 +25,7 @@ where
2425

2526
// send 0 balance to the account so an ID address for it is created and then try to resolve
2627
rt.send(*address, METHOD_SEND, Default::default(), Default::default())
27-
.map_err(|e| e.wrap(&format!("failed to send zero balance to address {}", address)))?;
28+
.with_context(|| format!("failed to send zero balance to address {}", address))?;
2829

2930
rt.resolve_address(address).ok_or_else(|| {
3031
anyhow::anyhow!(

actors/runtime/src/runtime/actor_code.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ pub trait ActorCode {
2121
// hold onto state between transactions.
2222
// https://github.com/filecoin-project/builtin-actors/issues/133
2323
BS: Blockstore + Clone,
24-
RT: Runtime<BS>;
24+
RT: Runtime<BS>,
25+
ActorError: From<RT::Error>;
2526
}

0 commit comments

Comments
 (0)