Smithery Logo
MCPsSkillsDocsPricing
Login
Smithery Logo

Accelerating the Agent Economy

Resources

DocumentationPrivacy PolicySystem Status

Company

PricingAboutBlog

Connect

© 2026 Smithery. All rights reserved.

    13eholder

    m06-error-handling

    13eholder/m06-error-handling
    Productivity
    6

    About

    SKILL.md

    Install

    Install via Skills CLI

    or add to your agent
    • Claude Code
      Claude Code
    • Codex
      Codex
    • OpenClaw
      OpenClaw
    • Cursor
      Cursor
    • Amp
      Amp
    • GitHub Copilot
      GitHub Copilot
    • Gemini CLI
      Gemini CLI
    • Kilo Code
      Kilo Code
    • Junie
      Junie
    • Replit
      Replit
    • Windsurf
      Windsurf
    • Cline
      Cline
    • Continue
      Continue
    • OpenCode
      OpenCode
    • OpenHands
      OpenHands
    • Roo Code
      Roo Code
    • Augment
      Augment
    • Goose
      Goose
    • Trae
      Trae
    • Zencoder
      Zencoder
    • Antigravity
      Antigravity
    ├─
    ├─
    └─

    About

    Mastering C++ Error Handling. Triggers: exceptions, try-catch, noexcept, std::expected, std::optional, error codes, assert, terminate.

    SKILL.md

    C++ Error Handling

    Core Question

    Is this error recoverable?

    • Yes (Local): std::expected or return code.
    • Yes (Distant): Exceptions (throw).
    • No (Bug): assert or std::terminate.

    Error → Design Question

    Issue Design Question
    Uncaught Exception Did you forget to catch, or throw in noexcept?
    Silent Failure Did you ignore a return code? (Use [[nodiscard]]).
    Destructor Throw Never throw from destructor (std::terminate).

    Thinking Prompt

    1. Is absence valid?

      • Yes? → std::optional<T>.
    2. Does caller need details?

      • Yes? → std::expected<T, E> or Exception.
      • No? → bool or std::optional.
    3. Is it a Logic Error (Bug)?

      • Yes? → assert() or std::terminate(). Do not throw for bugs in C++ (Contract Violation).

    Trace Up / Down

    • Trace Up:
      • Issue: "Program aborted with 'terminate called recursively'."
      • Cause: An exception was thrown while stack unwinding (in a destructor).
      • Fix: Fix the destructor. Ensure RAII cleanup is noexcept.

    Quick Reference

    Mechanism Cost (Happy) Cost (Sad) Use When
    std::optional Branch Branch Return may be empty.
    std::expected Branch Branch Recoverable error (Parsing).
    Exception Zero Huge Rare IO/Resource errors.
    Assert Zero (Release) Abort Logic bugs / Invariants.
    Recommended Servers
    Sentry
    Sentry
    Vercel Grep
    Vercel Grep
    vastlint - IAB XML VAST validator and linter
    vastlint - IAB XML VAST validator and linter
    Repository
    13eholder/modern-cpp-skills
    Files