@oluso/react-native
v1.1.0
Published
Oluso error monitoring for React Native applications: an error boundary, provider, and hook for automatic and manual error reporting
Maintainers
Readme
@oluso/react-native
AI-powered error monitoring for React Native applications: automatic error reporting, breadcrumb tracking, and intelligent error grouping on-device.
Installation
npm install @oluso/react-nativeOptional, but recommended so queued reports survive app restarts:
npm install @react-native-async-storage/async-storageFeatures
- Error Boundary: Catches render-time errors in a subtree and reports them automatically.
- Global Capture: Catches uncaught JS exceptions and fatal errors via
ErrorUtils, without disabling React Native's own red-box/crash handling. - Breadcrumbs: Tracks events leading to an error for better debugging.
- User Context: Tie errors to specific users.
- Deduplication: Intelligent fingerprinting groups similar errors together.
- Offline Reliability: Queues reports (in
AsyncStorage, when installed) when the network is unreachable, and retries on the next successful send. WithoutAsyncStorage, the queue still works for the current app session, it just doesn't survive a restart.
Usage
Wrap your app in OlusoProvider, then use ErrorBoundary around any subtree you want to protect:
import { OlusoProvider, ErrorBoundary, useOluso } from '@oluso/react-native';
import { Text, View } from 'react-native';
export default function App() {
return (
<OlusoProvider options={{ apiKey: 'your-api-key', environment: 'production' }}>
<Dashboard />
</OlusoProvider>
);
}
function Dashboard() {
const oluso = useOluso();
return (
<ErrorBoundary client={oluso} fallback={<Text>Something went wrong.</Text>}>
<Widgets />
</ErrorBoundary>
);
}Note: like all React error boundaries,
ErrorBoundaryonly catches errors thrown during rendering, in lifecycle methods, and in constructors — not in event handlers or async code. Those are still caught by the globalErrorUtilshandler, or can be reported manually withuseOluso().captureException().
Manual Reporting & Context
import { useOluso } from '@oluso/react-native';
function CheckoutButton() {
const oluso = useOluso();
const handlePress = async () => {
oluso.addBreadcrumb({ message: 'User started checkout', category: 'action' });
try {
await checkout();
} catch (error) {
oluso.captureException(error as Error, { step: 'checkout' });
}
};
return <Button title="Checkout" onPress={handlePress} />;
}Advanced Configuration
new OlusoClient({
apiKey: 'your-api-key',
endpoint: 'https://api.oluso.dev/api/v1/error/report', // override for self-hosting
environment: 'staging',
defaultSeverity: 'medium',
maxBreadcrumbs: 50,
maxErrorsPerMinute: 100,
enableOfflineQueue: true,
sensitiveKeys: ['ssn', 'api_key'],
shouldReport: (err) => !err.message.includes('Failed to fetch'),
});Process monitors
The OlusoClient instance exposes heartbeat(url, options), assertOutcome(options), and workflow(reference, runId?), with the same redaction and retry guarantees as the other JavaScript SDKs. See the complete monitor guide.
License
MIT
