Problem: SplitError is a #[contracterror] enum with only integer codes. The backend translateSorobanError in lib/errors.ts maps codes to messages, but the contract itself has no documentation linking the integer code back to the error variant in the emitted error XDR. If a new frontend developer sees error code 4 in a Soroban response, they must look it up manually.
Scope: Add a to_message() method to SplitError returning a &'static str description.
Implementation guidance:
Implement impl SplitError { pub fn to_message(&self) -> &'static str { match self { ... } } } with a human-readable message for each variant.
This method is not callable from contract invocations (Soroban contracts return error codes, not messages), but it is useful in test output and off-chain tooling.
Update tests.rs to use err.to_message() in assertions where the message is more readable than the variant name.
Acceptance criteria: Every error variant has a non-empty message; test assertions use the message for clarity; cargo test passes.
Validation: cargo test output shows message strings in failure output.
Files to modify: contracts/errors.rs, contracts/tests.rs
Problem: SplitError is a #[contracterror] enum with only integer codes. The backend translateSorobanError in lib/errors.ts maps codes to messages, but the contract itself has no documentation linking the integer code back to the error variant in the emitted error XDR. If a new frontend developer sees error code 4 in a Soroban response, they must look it up manually.
Scope: Add a to_message() method to SplitError returning a &'static str description.
Implementation guidance:
Implement impl SplitError { pub fn to_message(&self) -> &'static str { match self { ... } } } with a human-readable message for each variant.
This method is not callable from contract invocations (Soroban contracts return error codes, not messages), but it is useful in test output and off-chain tooling.
Update tests.rs to use err.to_message() in assertions where the message is more readable than the variant name.
Acceptance criteria: Every error variant has a non-empty message; test assertions use the message for clarity; cargo test passes.
Validation: cargo test output shows message strings in failure output.
Files to modify: contracts/errors.rs, contracts/tests.rs