110-error-handling

110-error-handling is a cursor rule for Cursor from juandoroteoflesiauni-lang/Market-options-stocks-Scanner. It costs 0 tokens per session (2,459 once invoked), scanned A, original, Apache-2.0.

Error-handling and logging rules for a trading terminal. They require failures to be visible to the user, recorded in logs, or both, and define named errors for authentication and invalid input.

In plain words
What is it for?
Use them to define trading-specific exceptions, report unauthorized requests, validate user input, and record operational errors.
Why use it?
They reduce the risk that a failed order, incorrect loss calculation, or stale price goes unnoticed. This is especially important when software can affect trades or money.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them to define trading-specific exceptions, report unauthorized requests, validate user input, and record operational errors.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/juandoroteoflesiauni-lang/Market-options-stocks-Scanner

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 110-error-handling

README.md
[![agentmods](https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling/github.svg)](https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling)
Your own site
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 110-error-handling

Your own site · 80×15
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/110-error-handling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,459 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.02459
Opus 5 $0.00000 $0.01229
Sonnet 5 $0.00000 $0.00492
Haiku 4.5 $0.00000 $0.00246

Measured 12d ago against content hash 107e2f7f67a8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

110-error-handling scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const apiClient = axios.create({
.cursor/rules/110-error-handling.mdc · 348 lines

How it starts

The opening of the file, as written. The whole thing — 348 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🚨 MANEJO DE ERRORES Y LOGGING — TRADING TERMINAL

FILOSOFÍA: FAIL LOUDLY, NOT SILENTLY

En trading, un error silencioso puede significar:

  • Orden que se envió pero no se registró
  • Pérdida calculada incorrectamente
  • Precio desactualizado sin que el usuario lo sepa

Cada error DEBE ser visible: al usuario, en los logs, o ambos.


🐍 JERARQUÍA DE EXCEPCIONES (Python)

# core/exceptions.py — Mapa completo de excepciones del dominio

class TradingError(Exception):
    """Base de todas las excepciones. Nunca usar directamente."""
    def __init__(self, message: str, code: str = "TRADING_ERROR"):
        self.message = message
        self.code = code
        super().__init__(message)

# ── Errores de autenticación ──────────────────────────
class UnauthorizedError(TradingError):
    """JWT inválido, expirado, o usuario sin permisos."""
    def __init__(self, message: str = "No autorizado"):
        super().__init__(message, "UNAUTHORIZED")

# ── Errores de validación ──────────────────────────────
class ValidationError(TradingError):
    """Input del usuario es inválido."""
    def __init__(self, message: str, field: str = ""):
        self.field = field
        super().__init__(message, "VALIDATION_ERROR")

class InvalidSymbolError(ValidationError):
    """El símbolo de trading no existe o no está disponible."""
    pass

# ── Errores financieros ────────────────────────────────
class InsufficientFundsError(TradingError):
    """No hay fondos suficientes para la operación."""
    def __init__(self, required: float, available: float):
        super().__init__(
            f"Fondos insuficientes: necesitas ${required:.2f}, tienes ${available:.2f}",
            "INSUFFICIENT_FUNDS"
        )
        self.required = required
        self.available = available

class RiskViolationError(TradingError):
    """La operación viola las reglas de gestión de riesgo."""
    def __init__(self, message: str, rule: str = ""):
        self.rule = rule
        super().__init__(message, "RISK_VIOLATION")

# ── Errores de órdenes ─────────────────────────────────
class OrderNotFoundError(TradingError):
    """La orden no existe o no pertenece al usuario."""
    pass

class OrderAlreadyCancelledError(TradingError):
    """La orden ya fue cancelada y no se puede modificar."""
    pass

class OrderExecutionError(TradingError):
    """Error al ejecutar la orden en el exchange."""
    pass

# ── Errores de exchange ────────────────────────────────
class ExchangeConnectionError(TradingError):
    """Error de conexión con el exchange."""
    pass

class ExchangeRateLimitError(TradingError):
    """Se alcanzó el límite de solicitudes del exchange."""
    pass

Read the full file on GitHub · 348 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 348 lines · 0 tokens per session scan A 107e2f7f67a8

Subscribe to this mod's changes

110-error-handling is a cursor rule published in the GitHub repository juandoroteoflesiauni-lang/Market-options-stocks-Scanner (11 stars, last pushed 2mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,459 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.