name: cairo-recoverable-errors
description: Explain Cairo recoverable errors using Result, ResultTrait, and the ? operator; use when a request involves returning, matching, or unwrapping Result values in Cairo.
Cairo Recoverable Errors
Overview
Show how to model recoverable failures with Result<T, E> and handle them safely.
Quick Use
- Read
references/recoverable-errors.mdbefore answering. - Prefer
matchor?overunwrapin non-test code. - Mention
expectwhen a custom panic message is desired.
Response Checklist
- Return
Result<T, E>from fallible functions. - Use
Ok(...)andErr(...)explicitly. - Apply
?to propagate errors from called functions.
Example Requests
- "How do I use
Resultin Cairo?" - "What is the difference between
unwrapandexpect?" - "How does the
?operator work?"