"""Test endpoint for verifying error handlers work end-to-end. This is a development-only endpoint that raises domain errors to verify the FastAPI exception handlers in app/core/errors.py work correctly. """ from __future__ import annotations from app.core.errors import ( HoneypotDetectedError, InsufficientFundsError, PaymentRequiredError, WalletNotFoundError, ) from fastapi import APIRouter router = APIRouter(prefix="/api/v1/_test_errors", tags=["test-errors"]) @router.get("/wallet_not_found/{address}") async def test_wallet_not_found(address: str): """Raises WalletNotFoundError → 404 with code=wallet_not_found.""" raise WalletNotFoundError(address, "ethereum") @router.get("/insufficient_funds") async def test_insufficient_funds(): """Raises InsufficientFundsError → 402 with code=insufficient_funds.""" raise InsufficientFundsError(required=1.5, available=0.3, asset="SOL") @router.get("/honeypot/{address}") async def test_honeypot(address: str): """Raises HoneypotDetectedError → 422 with code=honeypot_detected.""" raise HoneypotDetectedError(address, "solana") @router.get("/payment_required") async def test_payment_required(): """Raises PaymentRequiredError → 402 with code=payment_required.""" raise PaymentRequiredError("scan_token", 0.05, "solana")