Ghost
Function error replay system for debugging
import { withGhost, replay } from '@sapphy/ghost'
// Wrap your function
const safeApiCall = withGhost('apiCall', fetchUserData)
// Errors are automatically captured
try {
safeApiCall(invalidUserId)
} catch (error) {
// Error captured with inputs for replay
}
// Replay the error later for debugging
const result = await replay(errorId)
Capture Errors Automatically
Ghost automatically captures function errors along with their inputs, making debugging effortless. No more guessing what caused the failure.
Replay & Debug
Replay captured errors with the exact same inputs to reproduce and debug issues. Perfect for understanding complex failure scenarios.
Pluggable Storage
Choose between in-memory storage for testing or file-based storage for persistence. Easy to implement custom storage backends.
TypeScript First
Built with TypeScript from the ground up. Full type safety and excellent IntelliSense support for the best developer experience.
Privacy Safe
Built-in redaction support to safely handle sensitive data. Configure what gets captured and what stays private.
Production Ready
Minimal performance impact, configurable storage limits, and robust error handling. Ready for production environments.
Why Ghost?
Debugging production errors is hard. You know something went wrong, but recreating the exact conditions that caused the failure is nearly impossible. Ghost solves this by automatically capturing function errors along with their inputs, allowing you to replay and debug issues with the exact data that caused them.
Before Ghost
- ❌ Errors happen in production with no context
- ❌ Difficult to reproduce exact failure conditions
- ❌ Time-consuming debugging sessions
- ❌ Guesswork about what inputs caused the error
With Ghost
- ✅ Automatic error capture with full context
- ✅ Instant replay with exact inputs
- ✅ Fast debugging and issue resolution
- ✅ Privacy-safe with built-in redaction