soroban-rpc: libpreflight: unwrap() errors due to bugs in the Go<->Rust interface #879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I understand this can be controversial, but there are good reasons for it. I intentionally created a separate followup PR from #875 in case it meets a strong opposition.
panicking will show the line number where the problem happens whereas otherwise we will get an error with no context at all (as an alternative we could add context to every use of
?
but that would make the code much more unreadable).We anyhow capture the panics before returning to Go and thus, the process won't stop.
Further context on why it's OK to use unwrap in these cases https://blog.burntsushi.net/unwrap/
Ideally we would simply have a way to selectively attach a backtrace/line-number to these errors instead, but I don't think that will be possible until rust-lang/rust#53487 lands. Also, even then I am not sure we will be able to pick when we want to show backtraces/line numbers (it seems to be all or nothing).