handling-rust-errors
HASH error handling patterns using error-stack crate. Use when working with Result types, Report types, defining custom errors, propagating errors with change_context, adding context with attach, implementing Error trait, or documenting error conditions in Rust code.
Install
mkdir -p .claude/skills/handling-rust-errors && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2724" && unzip -o skill.zip -d .claude/skills/handling-rust-errors && rm skill.zipInstalls to .claude/skills/handling-rust-errors
About this skill
Rust Error-Stack Patterns
HASH-specific error handling patterns using the error-stack crate for consistent, debuggable error handling across the Rust codebase.
Core Principles
HASH uses error-stack exclusively for error handling:
✅ DO:
- Use
Report<MyError>for all error types - Use concrete error types:
Report<MyError> - Import
Errorfromcore::error::(notstd::error::) - Import
ResultExt as _for trait methods
❌ DON'T:
- Use
anyhoworeyrecrates - Use
Box<dyn Error>(except in tests/prototyping) - Use
Report<Box<dyn Error>> - Use
thiserror(usederive_moreinstead)
HashQL Compiler Exception
HashQL compiler code uses a different error handling approach.
Code in libs/@local/hashql/* uses the hashql-diagnostics crate instead of error-stack. This is because compiler errors require rich formatting capabilities:
- Source spans pointing to exact code locations
- Multiple labeled regions within the same diagnostic
- Fix suggestions with replacement text
- Severity levels (error, warning, hint)
Which approach to use:
| Location | Error Handling |
|---|---|
libs/@local/hashql/* (compiler code) | Use hashql-diagnostics → See writing-hashql-diagnostics skill |
| Everywhere else | Use error-stack patterns from this skill |
Traditional error-stack patterns still apply for HashQL infrastructure code (CLI, file I/O, configuration) that doesn't involve compiler diagnostics.
Quick Start Guide
Choose the reference that matches your current task:
Defining Errors
Use when: Creating new error types or error enums
- Define error types with
derive_more - Error enum patterns and variants
- Implement the
Errortrait - Error type hierarchies
Propagating Errors
Use when: Handling Result types, using ? operator
- Convert errors with
.change_context()and.change_context_with() - Add context with
.attach()and.attach_with() - Error conversion patterns
Documenting Errors
Use when: Writing doc comments for fallible functions
# Errorssection format- Link error variants
- Document runtime errors
- Test error conditions
Common Quick Patterns
Creating an Error
use error_stack::Report;
return Err(Report::new(MyError::NotFound))
.attach(format!("ID: {}", id));
Propagating with Context
use error_stack::ResultExt as _;
some_result
.change_context(MyError::OperationFailed)
.attach("Additional context")?;
Lazy Context (for expensive operations)
use error_stack::ResultExt as _;
expensive_operation()
.change_context(MyError::OperationFailed)
.attach_with(|| format!("Debug info: {:?}", expensive_computation()))?;
References
- Defining Errors - Creating new error types or error enums
- Propagating Errors - Handling
Resulttypes, using?operator - Documenting Errors - Writing doc comments for fallible functions
More by hashintel
View all skills by hashintel →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
pdf-to-markdown
aliceisjustplaying
Convert entire PDF documents to clean, structured Markdown for full context loading. Use this skill when the user wants to extract ALL text from a PDF into context (not grep/search), when discussing or analyzing PDF content in full, when the user mentions "load the whole PDF", "bring the PDF into context", "read the entire PDF", or when partial extraction/grepping would miss important context. This is the preferred method for PDF text extraction over page-by-page or grep approaches.
Related MCP Servers
Browse all serversIntegrate with Google Drive and GCloud Storage via Google Cloud Platform for seamless access to Compute Engine, BigQuery
Baidu Search provides fast web search using baidu.com. Retrieve results and webpage content with robust error handling a
MCP server for Perplexity AI search and research capabilities with robust error handling and secure validation for LLM a
Generate images from text prompts using ModelScope Qwen-Image with format auto-detection and robust multilingual support
Kokoro Speech: natural-sounding Kokoro TTS with customizable voices and playback speed — fast, reliable text-to-speech w
Specif-ai ensures secure web API access and robust error handling, making it a top choice among API security companies f