Skip to content

Error handling migration: Result-based API instead of panic #41

@greatest0fallt1me

Description

@greatest0fallt1me

Description

Evaluate migrating public functions from panic! to Result with contracterror! enum for clearer client errors.

Requirements and context

  • Breaking ABI change — version bump and migration guide.
  • Prefer phased approach if needed.

Suggested execution

  • Fork the repository and create a branch (example below).
  • Implement the changes in the StreamPay-Contracts Soroban crate (streampay-contracts).
  • Keep the contract secure, tested, and documented; prefer small, reviewable diffs.
git checkout -b feature/contract-error-enum

Implementation targets

  • lib.rs — define errors; update tests.
  • docs/errors.md.

Tests and validation

  • All former panic paths return distinct errors.

  • Run cargo test in StreamPay-Contracts.

  • Cover edge cases; capture test output and short security notes in the PR description.

Guidelines

  • Target minimum 95% test coverage for touched contract code (or justify gaps explicitly).
  • Clear documentation (rustdoc / project docs as specified).
  • Timeframe: 96 hours from assignment.

Example commit message

feat(contracts): structured errors for stream operations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions