Skip to content

Fix the try_ result nesting in the smart-contracts skill - #170

Merged
stellar-triage-bot[bot] merged 1 commit into
mainfrom
issue-agent/163-try-result-nesting
Nov 2, 2026
Merged

stellar-triage-bot[bot] merged 1 commit into
mainfrom
issue-agent/163-try-result-nesting

Conversation

@stellar-triage-bot

Copy link
Copy Markdown
Contributor

🤖 Automated message from the Stellar Triage Bot.

Closes #163. Generated try_foo() methods return Result<Result<T, _>, Result<E, InvokeError>>, so the typed contract error is Err(Ok(e)).

  • Rewrite the try_ sentence in development.md with the meaning of each arm and an assert_eq! example.
  • Note that a function without a Result return uses soroban_sdk::Error as E.
  • Note that budget and footprint failures are not recoverable, so try_ cannot catch them. The old text listed "budget" as a catchable error.
  • New eval scenario: smart-contracts/06-try-error-matching.json.

Verified on soroban-sdk 29.0.1 in a scratch crate: cargo test passes for Err(Ok(ContractError::InvalidAmount)), Err(Err(InvokeError::Abort)) on a failed auth in a Result function, and Err(Ok(Error(Context, InvalidAction))) in a plain function.

Generated try_foo() methods return
Result<Result<T, _>, Result<E, InvokeError>>, so the contract's typed
error is Err(Ok(e)), not Ok(Err(e)). Spell out what each arm means, note
that functions without a Result return use soroban_sdk::Error as E, and
that budget and footprint failures are not recoverable. Add an eval
scenario for matching a typed error in a test.
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-11-02 22:30 UTC

@stellar-triage-bot

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from the Stellar Triage Bot.

Verification at 51d88e0:

  • try_output in soroban-sdk-macros/src/syn_ext.rs and Env::try_invoke_contract at v29.0.1 return Result<Result<T, _>, Result<E, InvokeError>>.
  • A scratch crate on 29.0.1 passes cargo test for all three cases in the new text.
  • HostError::is_recoverable in rs-soroban-env v29.0.1 marks budget and footprint limit errors as non-recoverable.
  • The preview check passed. The branch merges cleanly on main after Move the smart-contracts skill to Protocol 29 and soroban-sdk 29 #169. Copilot did not attach a review.

Merging.

@stellar-triage-bot
stellar-triage-bot Bot merged commit b836970 into main Nov 2, 2026
7 checks passed
@stellar-triage-bot
stellar-triage-bot Bot deleted the issue-agent/163-try-result-nesting branch November 2, 2026 22:30
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.

development.md swaps the try_ result nesting: soroban-sdk returns the contract error as Err(Ok(e)), not Ok(Err(e))

0 participants