docs: document when each ContractError variant is returned (#698) - #718
Closed
ayomidearegbeshola29-dev wants to merge 1 commit into
Closed
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add doc-comments explaining when each
ContractErrorvariant is returnedSummary
Closes #698
Every variant of the unified
ContractErrortaxonomy(
contracts/split/src/error.rs) now carries a///doc comment that explainswhen the contract returns it. Previously ~21 variants (discriminants 1–18,
23, 24, 25) had no documentation, which made the error taxonomy hard to use
for contributors wiring up new failure paths and for integrators mapping error
codes.
The comments follow the existing convention already used by the documented
variants: a one-line
///description of the trigger condition, referencingthe originating issue where applicable (e.g.
/// Issue #330: ...).What changed
NotAuthorized,InvoiceNotFound,DeadlinePassed,AlreadyFunded,InvalidAmount,InvoiceFrozen,InvalidStatus,PayerNotAllowed,FundingInsufficient,OracleCallFailed,NotArbiter,NotDisputed,AlreadyExecuted,TimelockPending,ContractPaused,InvalidRecipients,PrerequisiteNotMet,BatchLimitExceeded,InvalidRating,AlreadyRated,RateLimitExceeded.on-chain error-code contract), so this is a non-breaking documentation-only
change.
Verification
This is a documentation-only change; no code paths changed. Doc comments do not
affect compilation, so existing builds/tests are unaffected by the content.
(Note:
cargo checkonmaincurrently fails for an unrelated, pre-existingreason — a malformed duplicate
invoice_expiredinevents.rs. That is trackedseparately and is not introduced by this PR.)
Notes for reviewers
the issue's acceptance criterion, rather thanrestating the variant name.
comment concise; where it depended on a feature flag or list (e.g.
PayerNotAllowed↔allowed_payers) I called that out.closes #698