Skip to content

feat(common): add shared #[contracterror] Error enum and use panic_with_error! (#89) - #1143

Closed
jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:feat/common-contracterror-codes-89
Closed

jeffrey-graham wants to merge 1 commit into
DevTobis:mainfrom
jeffrey-graham:feat/common-contracterror-codes-89

Conversation

@jeffrey-graham

Copy link
Copy Markdown

Closes #89

Summary

  • Adds contracts/common/src/error.rs defining #[contracterror] #[repr(u32)] pub enum Error for shared access-control and pause errors (NotInitialized, Unauthorized, NoPendingAdmin, NoPendingRoleChange, TimelockNotElapsed, Paused) and re-exports it from ballast-common.
  • Updates contracts/common/src/access.rs and contracts/common/src/pause.rs to abort with soroban_sdk::panic_with_error!(env, Error::...) so callers and indexers receive structured Error(Contract, #N) status codes instead of opaque string panics.
  • Updates contracts/repo-dvp/src/test.rs pause test attributes and documents the error code table in contracts/README.md.

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.

Add shared #[contracterror] codes to ballast-common instead of string panics

1 participant