leoyvens opened PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
leoyvens updated PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
leoyvens updated PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
alexcrichton submitted PR Review.
alexcrichton submitted PR Review.
alexcrichton created PR Review Comment:
I think here it's best to leave this as
&str. I don't think this is too too useful as an API and we can honestly probably remove it.If this remains I think this should return a simple canned string for user-provided errors, since users of
Trapneed to be aware anyway that there's multiple ways to create aTrap.
alexcrichton created PR Review Comment:
I don't think this quite what we want because the semantics of
anyhowis that it searches the entire chain of errors and returnsTrapif anything is aTrap, which means that this can lose context.
alexcrichton created PR Review Comment:
Since the error itself is printed as part of
DisplayI think this will want to calle.source()since theTrapalready represents the top-level error.
leoyvens updated PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
leoyvens submitted PR Review.
leoyvens created PR Review Comment:
Makes sense, did that.
leoyvens updated PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
leoyvens submitted PR Review.
leoyvens created PR Review Comment:
I've removed this fn since I agree it's not a useful API. I changed all tests using it to test for
trap.to_string().contains("...")
leoyvens submitted PR Review.
leoyvens created PR Review Comment:
Good point, I was not aware of this. I made this impl delegate to the
Box<dyn Error + Send + Sync>one, and used the std errordowncast_refthere.
leoyvens updated PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
leoyvens submitted PR Review.
leoyvens created PR Review Comment:
It seems that the most important place where this was used was the C api
wasm_trap_message. I've switched that toto_string()if that's ok.
leoyvens updated PR #1753 from from-error-for-trap to master:
This is useful for using
?in functions exported from the host which returnResult<_, Trap>.
alexcrichton merged PR #1753.
Last updated: Dec 06 2025 at 06:05 UTC