API Reference
Complete API reference for ErrorMail.
configureErrorReporting(config)
Configure the error reporting service globally.
configureErrorReporting({ apiKey: 'your-api-key', emailTo: 'admin@example.com' });
ErrorBoundary
React component that catches errors in child components.
<ErrorBoundary emailTo="admin@example.com"> <MyComponent /> </ErrorBoundary>
withErrorBoundary(Component, options)
Higher-order component that wraps a component with ErrorBoundary.
const SafeComponent = withErrorBoundary(MyComponent, { emailTo: 'admin@example.com' });
errormail(emailToOrFn, fnOrOptions, options)
Wraps functions to catch and report errors.
// Curried const safeFn = errormail('admin@example.com')(myFunction); // Direct const safeFn = errormail('admin@example.com', myFunction); // With options const safeFn = errormail(myFunction, { emailTo: 'admin@example.com' });
wrapSyncFunction(fn, options)
Wraps synchronous functions to catch and report errors.
const safeFn = wrapSyncFunction(myFunction, { emailTo: 'admin@example.com' });
ErrorReportingService
Advanced: Create custom error reporting service instances.
import { ErrorReportingService } from 'errormail'; const customService = new ErrorReportingService({ apiKey: 'custom-key', emailTo: 'custom@example.com' });