Skip to content

Document which contract errors try_call can recover from - #2825

Merged
ElliotFriend merged 1 commit into
mainfrom
docs-agent/1074-recoverable-contract-errors
Sep 8, 2026
Merged

Document which contract errors try_call can recover from#2825
ElliotFriend merged 1 commit into
mainfrom
docs-agent/1074-recoverable-contract-errors

Conversation

@kaankacar

@kaankacar kaankacar commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Triage bot, acting for @kaankacar.

Closes #1074

Two pages said try_ catches every error from a contract call. It does not. HostError::is_recoverable in rs-soroban-env v28.0.2 makes two groups non-recoverable, and try_call re-raises those, so the guest traps and the transaction fails. This corrects both sentences and adds one section that states the rule, on the page that already defines call and try_call. @dmkozh named the same two groups in the issue.

Non-recoverable, from soroban-env-host/src/host/error.rs:

  • code ExceededLimit with type Budget or Storage
  • code InternalError with any type other than Contract

The Storage case is the footprint violation. The issue calls it the one non-obvious case, so it gets its own paragraph.

Two notes. This adds no page and no new URL, so it does not answer the "common gotchas page" idea in the issue. Open PR #2732 edits the <head> block of the same overview page, four lines from my hunk.

The interactions overview said try_call returns an Error "on any error", and the cross-contract guide said try_ means "underlying errors won't make the contract panic". Neither holds. HostError::is_recoverable in rs-soroban-env treats resource limit errors (Budget or Storage with ExceededLimit) and non-contract InternalError as non-recoverable, and try_call re-raises those, so the guest traps and the transaction fails.

Add a Recoverable and Non-Recoverable Errors section to the overview and point the guide at it. Call out the footprint case, which is the non-obvious one.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Clarifies which contract-call errors try_call and SDK try_ methods can recover from.

Changes:

  • Documents recoverable and non-recoverable host errors.
  • Adds a caution to the cross-contract guide.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/learn/fundamentals/contract-development/contract-interactions/overview.mdx Defines error recovery behavior and footprint failures.
docs/build/guides/conventions/cross-contract.mdx Warns that some errors still trap.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@kaankacar

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from Kaan's Automated Triage Bot.

Verified against rs-soroban-env v28.0.2: HostError::is_recoverable and try_call match both non-recoverable groups exactly. The preview renders and the new anchor resolves from the cross-contract caution. Ready to merge.

@kaankacar kaankacar added the bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge label Sep 7, 2026
@ElliotFriend
ElliotFriend merged commit 73384bd into main Sep 8, 2026
10 checks passed
@ElliotFriend
ElliotFriend deleted the docs-agent/1074-recoverable-contract-errors branch September 8, 2026 15:28
@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Preview: torn down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document recoverable versus nonrecoverable contract errors

3 participants