One-click install
npx skills add https://github.com/yumazak/kodo --skill m06-error-handling-yumazak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m06-error-handling
Source: https://github.com/yumazak/kodo/tree/main/.agents/skills/m06-error-handling
Command: npx skills add https://github.com/yumazak/kodo --skill m06-error-handling-yumazak

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently designing robust error handling in Rust prevents crashes and unclear failure modes across libraries and applications.

Core Features & Use Cases

  • Precise error type design for library boundaries
  • Contextual propagation using standard crates like thiserror and anyhow
  • Clear guidance on when to panic vs return and how to surface friendly messages

Quick Start

Explain how to implement robust error handling in Rust projects with practical examples.

Frequently Asked Questions about m06-error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design robust error handling in Rust to prevent crashes across libraries?

Designing robust Rust error handling involves defining precise error types and clear propagation to prevent unclear failure modes across libraries and applications. You achieve this by targeting specific library boundaries and contextual information layers.

What is the best way to use thiserror and anyhow for Rust error propagation?

The best way to use thiserror and anyhow for Rust error propagation is applying thiserror for precise library boundary error types and anyhow for application-level contextual propagation. This separation ensures clear, context-aware error hierarchies.

How do I convert Rust Options to Results and avoid unwrap pitfalls?

Converting Rust Options to Results avoids unwrap pitfalls by forcing explicit error handling rather than risking panics. You satisfy options-to-results conversions by mapping None cases into defined error types instead of calling unwrap directly.

When should I panic vs return an error in Rust application design?

You should panic vs return an error in Rust based on whether the failure is recoverable; return errors for expected failures across layers and panic for unrecoverable state violations. Clear guidance surfaces friendly messages for recoverable contextual failures.

Does this error handling approach work for both Rust libraries and applications?

Yes, this Rust error handling approach works for both libraries and applications by defining precise error types for library boundaries and using contextual propagation for application scenarios. It targets unwrap pitfalls and context-aware hierarchies across layers.