AgentSkillsCN

cairo-recoverable-errors

当在 Cairo 中遇到与 Rust 不同的意外编译错误或行为时,讲解 Cairo 语言的特殊之处、常见陷阱,以及惯用的规避方案。

SKILL.md
--- frontmatter
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.md before answering.
  • Prefer match or ? over unwrap in non-test code.
  • Mention expect when a custom panic message is desired.

Response Checklist

  • Return Result<T, E> from fallible functions.
  • Use Ok(...) and Err(...) explicitly.
  • Apply ? to propagate errors from called functions.

Example Requests

  • "How do I use Result in Cairo?"
  • "What is the difference between unwrap and expect?"
  • "How does the ? operator work?"

Cairo by Example