Stream: git-wasmtime

Topic: wasmtime / PR #1753 impl From<anyhow::Error> for Trap


view this post on Zulip Wasmtime GitHub notifications bot (May 25 2020 at 19:00):

leoyvens opened PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 22:16):

leoyvens updated PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 27 2020 at 22:22):

leoyvens updated PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 16:12):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 16:12):

alexcrichton submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 16:12):

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 Trap need to be aware anyway that there's multiple ways to create a Trap.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 16:12):

alexcrichton created PR Review Comment:

I don't think this quite what we want because the semantics of anyhow is that it searches the entire chain of errors and returns Trap if anything is a Trap, which means that this can lose context.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 16:12):

alexcrichton created PR Review Comment:

Since the error itself is printed as part of Display I think this will want to call e.source() since the Trap already represents the top-level error.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:20):

leoyvens updated PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:46):

leoyvens submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:46):

leoyvens created PR Review Comment:

Makes sense, did that.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:47):

leoyvens updated PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:47):

leoyvens submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:47):

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("...")

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:48):

leoyvens submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:48):

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 error downcast_ref there.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:56):

leoyvens updated PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:57):

leoyvens submitted PR Review.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 18:57):

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 to to_string() if that's ok.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 19:38):

leoyvens updated PR #1753 from from-error-for-trap to master:

This is useful for using ? in functions exported from the host which return Result<_, Trap>.

view this post on Zulip Wasmtime GitHub notifications bot (May 29 2020 at 20:24):

alexcrichton merged PR #1753.


Last updated: Nov 22 2024 at 16:03 UTC