You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Audience: Smart-contract contributors and reviewers.
Every error the QuickLendX contract can return, grouped by domain. The source of truth is the
QuickLendXError enum in quicklendx-contracts/src/errors.rs (and FreshnessError in
quicklendx-contracts/src/freshness.rs). The Soroban host surfaces these as
ContractError(ErrorContractResult::Err(u32)) where the u32 is the discriminant below.
Using error codes in tests
usecrate::errors::QuickLendXError;// Match a returned errorlet result = contract.try_create_invoice(&env,&inv);assert_eq!(result,Err(Ok(QuickLendXError::InvoiceAmountInvalid)));// Extract the numeric discriminantassert_eq!(QuickLendXError::InvoiceNotFoundasu32,1000);
Off-chain integrators can inspect the u32 value in the transaction result meta — the mapping
below is stable. Do not renumber any variant marked "public ABI" in the source.
QuickLendXError (primary contract error enum)
Invoice lifecycle — 1000–1007
Code
Variant
ABI symbol
Meaning
1000
InvoiceNotFound
INV_NF
Invoice lookup failed — the supplied invoice ID does not exist.
1001
InvoiceNotAvailableForFunding
INV_NAF
Funding was attempted while the invoice is not in a fundable state.
1002
InvoiceAlreadyFunded
INV_AF
A funding path was entered for an invoice that already has funding.
The underlying token contract transfer or transfer-from call failed.
2201
MaintenanceModeActive
MAINT
A mutating operation was attempted during maintenance mode.
2202
DuplicateDefaultTransition
DEF_DUP
A default transition was run more than once for the same invoice.
2203
BackupVersionUnsupported
BKP_VER
The backup data version is not supported by the current contract.
2204
DuplicateBid
(missing from Symbol map)
A duplicate bid was detected (idempotency check).
FreshnessError (data freshness sub-error)
Defined in quicklendx-contracts/src/freshness.rs.
Code
Variant
Meaning
1
NotAuthorized
The caller lacks authorization for the freshness operation.
2
StaleDataRejected
Off-chain data exceeds the configured freshness drift threshold.
3
InvalidConfigValue
The freshness configuration value is invalid.
Code example: matching errors in Rust
usecrate::errors::QuickLendXError;/// Returns the user-facing message for common error codes.pubfndescribe_error_code(code:u32) -> &'staticstr{match code {1000 => "Invoice not found",1100 => "Caller not authorized",1401 => "Operation not allowed in current state",2100 => "Contract is paused",
_ => "Unknown error",}}
Maintaining this document
This document is generated by auditing src/errors.rs and src/freshness.rs. When adding a new
variant:
Add it to the appropriate domain group in QuickLendXError.
Add the corresponding symbol_short! entry in the From<QuickLendXError> for Symbol impl.
Update the table above.
Add the variant to the stability snapshot if test_error_code_stability covers it.
Never renumber an existing variant — numeric values are public ABI.