Skip to content

Add recovery package with panic recovery middleware - #10

Merged
JAORMX merged 1 commit into
mainfrom
add-recovery-package
Feb 4, 2026
Merged

Add recovery package with panic recovery middleware#10
JAORMX merged 1 commit into
mainfrom
add-recovery-package

Conversation

@JAORMX

@JAORMX JAORMX commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add recovery package providing HTTP middleware that recovers from panics
  • Extracted from toolhive/pkg/recovery as part of THV-0032 (Tier 1 graduation)
  • Adapted to remove toolhive-internal dependencies

Components

File Description
doc.go Package documentation with usage examples
recovery.go Core Middleware function for panic recovery
recovery_test.go Unit tests with 100% coverage

Changes from Original

Logging Deferred

Logging support is intentionally deferred until common logging is established across ToolHive. See #7 for tracking.

Test Plan

  • All unit tests pass (task test)
  • Linting passes (task lint)
  • License headers validated (task license-check)
  • Test coverage: 100%

🤖 Generated with Claude Code

Add the recovery package which provides HTTP middleware that recovers
from panics and returns a 500 Internal Server Error response. This
prevents individual panicking requests from crashing the server.

The package is extracted from toolhive/pkg/recovery with adaptations:
- Removed toolhive-specific dependencies (logger, transport/types)
- Removed factory pattern types (too coupled to toolhive internals)
- Added TODO referencing #7 for future logging support

Logging support will be added once common logging is established
across the ToolHive ecosystem.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@JAORMX
JAORMX merged commit 3379fdb into main Feb 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants