Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ConversionError from ScVal/Val conversions #1339

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Jan 31, 2024

This is as minimal a change as I could manage to remove ConversionError from the ScVal/Val conversion paths, allowing Error codes to flow through (eg. invalid inputs or, more importantly, budget exhaustion or the like).

This is observable, and it does break public API (contra semver) so .. we should be sure if we want to do it. It also has a corresponding SDK change I'll post shortly. But I think it's very worthwhile and one of the last bugs I really wanted to fix before locking things down. Didn't think we'd be able to, but it looks like enough got cleaned up in the meantime that it was possible.

Fixes #1076
Fixes #1046

@graydon graydon added this pull request to the merge queue Jan 31, 2024
Merged via the queue into main with commit 096d461 Jan 31, 2024
13 checks passed
@graydon graydon deleted the bug-1076-conversion-error-flattening branch January 31, 2024 22:11
github-merge-queue bot pushed a commit to stellar/rs-soroban-sdk that referenced this pull request Feb 2, 2024
This is the SDK companion to
stellar/rs-soroban-env#1339 -- it won't work
until that change has landed and its refs have updated to point to it.

There's an explanation of the change over there, but briefly: we were
discarding meaningful errors when passing through the `TryFromVal<ScVal>
for Val` and `TryFromVal<Val> for ScVal` impls in env-common, and now
(or at least if 1339 lands) we're not. Instead of returning
`ConversionError` we'd be returning `Error`.

The SDK happens to _also_ have conversions with `ConversionError`
signatures, and I've opted in this PR to _not_ go a step further and
actually change those to `Error`, instead re-burying the `Error` into
`ConversionError` in the SDK, keeping the SDK APIs as they are. I could
also change them. But I figured that could be left to @leighmcculloch's
choice; he might want to keep the SDK's error repertoire simpler, I'm
not sure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TryFromVal<E, Val> for ScVal collapses Errors too much use of ConversionError
3 participants