Skip to content

Commit d9c57d1

Browse files
committed
Add React Native client agent skill docs
1 parent 5ecc496 commit d9c57d1

2 files changed

Lines changed: 131 additions & 1 deletion

File tree

.agents/skills/exceptionless-javascript/SKILL.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: exceptionless-javascript
3-
description: Use this skill when a developer wants to install, configure, troubleshoot, or integrate Exceptionless JavaScript clients for browser, Node.js, React, Vue, AngularJS, Express, Next.js, SvelteKit, or custom runtimes. Use it for API keys, startup, self-hosting, sending errors/logs/feature usage/404/custom events, indexed event properties, sessions, heartbeats, user identity, PII/data exclusions, plugins, runtime client configuration values, queues, and production setup even if they only ask "how do I wire up Exceptionless?"
3+
description: Use this skill when a developer wants to install, configure, troubleshoot, or integrate Exceptionless JavaScript clients for browser, Node.js, React, React Native, Expo, Vue, AngularJS, Express, Next.js, SvelteKit, or custom runtimes. Use it for API keys, startup, self-hosting, sending errors/logs/feature usage/404/custom events, indexed event properties, sessions, heartbeats, user identity, PII/data exclusions, plugins, runtime client configuration values, queues, native crash reporting, and production setup even if they only ask "how do I wire up Exceptionless?"
44
---
55

66
# Exceptionless JavaScript SDK
@@ -38,6 +38,7 @@ Read only the reference that matches the user's runtime, then add shared referen
3838
- `@exceptionless/browser`: [references/client-browser.md](references/client-browser.md)
3939
- `@exceptionless/node`: [references/client-node.md](references/client-node.md)
4040
- `@exceptionless/react`: [references/client-react.md](references/client-react.md)
41+
- `@exceptionless/react-native`: [references/client-react-native.md](references/client-react-native.md)
4142
- `@exceptionless/vue`: [references/client-vue.md](references/client-vue.md)
4243
- `@exceptionless/angularjs`: [references/client-angularjs.md](references/client-angularjs.md)
4344
- Sending events: [references/sending-events.md](references/sending-events.md)
@@ -52,6 +53,8 @@ Read only the reference that matches the user's runtime, then add shared referen
5253

5354
- Use `Exceptionless.startup(...)` once during app startup. `startup()` with no args is used later by lifecycle plugins to resume timers/queue processing.
5455
- Use the singleton from the platform package when automatic capture matters. Create `ExceptionlessClient` manually only for custom pipelines or tests.
56+
- For React Native or Expo apps, use `@exceptionless/react-native`; do not substitute `@exceptionless/browser` or `@exceptionless/react`.
57+
- In Expo, add `@exceptionless/react-native/expo-plugin` when native iOS crash reporting is expected. Expo Go can report JavaScript errors but cannot load the native crash reporter.
5558
- `submitException` and `createException` take an `Error`. For unknown caught values, use exported `toError(value)` when available.
5659
- `markAsCritical()` marks the event critical; `markAsCritical(false)` leaves tags unchanged.
5760
- `config.serverUrl` also sets `configServerUrl` and `heartbeatServerUrl`; assign custom endpoint overrides after setting `serverUrl`.
@@ -80,4 +83,7 @@ Verify behavior in:
8083
- `packages/core/src/submission/DefaultSubmissionClient.ts`
8184
- `packages/browser/src/BrowserExceptionlessClient.ts`
8285
- `packages/node/src/NodeExceptionlessClient.ts`
86+
- `packages/react-native/src/ReactNativeExceptionlessClient.ts`
87+
- `packages/react-native/src/plugins/ReactNativeErrorPlugin.ts`
88+
- `packages/react-native/src/plugins/NativeCrashPlugin.ts`
8389
- Package READMEs and `example/` apps.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# @exceptionless/react-native
2+
3+
Use for React Native and Expo apps. This package adds a React Native client, AsyncStorage-backed persistence, React Native/Hermes stack parsing, lifecycle handling, global JavaScript error capture, an error boundary, and iOS native crash reporting.
4+
5+
## Install
6+
7+
Expo:
8+
9+
```bash
10+
npx expo install @exceptionless/react-native @react-native-async-storage/async-storage
11+
```
12+
13+
React Native CLI:
14+
15+
```bash
16+
npm install @exceptionless/react-native @react-native-async-storage/async-storage
17+
cd ios && pod install
18+
```
19+
20+
For Expo development or standalone builds, add the config plugin:
21+
22+
```json
23+
{
24+
"expo": {
25+
"plugins": ["@exceptionless/react-native/expo-plugin"]
26+
}
27+
}
28+
```
29+
30+
Native iOS crash reporting requires an Expo development build, a standalone build, or a bare React Native app. Expo Go can capture JavaScript errors but cannot load the native crash reporter.
31+
32+
## Configure
33+
34+
Call `startup` once during app initialization:
35+
36+
```tsx
37+
import { Exceptionless } from "@exceptionless/react-native";
38+
39+
await Exceptionless.startup((config) => {
40+
config.apiKey = "API_KEY_HERE";
41+
config.setUserIdentity("12345678", "Blake");
42+
config.defaultTags.push("React Native");
43+
});
44+
```
45+
46+
For self-hosted Exceptionless:
47+
48+
```tsx
49+
await Exceptionless.startup((config) => {
50+
config.apiKey = "API_KEY_HERE";
51+
config.serverUrl = "https://exceptionless.example.com";
52+
});
53+
```
54+
55+
For local simulator development, prefer `http://localhost:<port>` when the app is running in the iOS simulator. Use a LAN IP only when a physical device must reach a server on the development machine.
56+
57+
## Error Boundary
58+
59+
Wrap rendering surfaces to capture React render errors and attach the React component stack to `@error.data["@component_stack"]`:
60+
61+
```tsx
62+
import { Text } from "react-native";
63+
import { ExceptionlessErrorBoundary } from "@exceptionless/react-native";
64+
65+
export function App() {
66+
return (
67+
<ExceptionlessErrorBoundary fallback={<Text>Something went wrong.</Text>}>
68+
<YourApp />
69+
</ExceptionlessErrorBoundary>
70+
);
71+
}
72+
```
73+
74+
React error boundaries do not catch event handlers, async failures, or manually swallowed errors. Submit those explicitly.
75+
76+
## Send
77+
78+
```tsx
79+
import { Exceptionless, toError } from "@exceptionless/react-native";
80+
81+
try {
82+
await saveProfile();
83+
} catch (error) {
84+
await Exceptionless.submitException(toError(error));
85+
}
86+
87+
await Exceptionless.submitLog("mobile", "Profile opened", "info");
88+
await Exceptionless.submitFeatureUsage("Profile Editor");
89+
90+
await Exceptionless.createException(new Error("Checkout failed"))
91+
.addTags("checkout", "mobile")
92+
.setProperty("orderId", "12345")
93+
.markAsCritical(true)
94+
.submit();
95+
```
96+
97+
## Captured Behavior
98+
99+
- Unhandled JavaScript errors and unhandled promise rejections are captured automatically after startup.
100+
- React Native/Hermes stack frames are parsed into structured Exceptionless stack frames.
101+
- iOS native crashes are persisted by PLCrashReporter and submitted on the next launch.
102+
- Device, OS, locale, React Native version, sessions, and lifecycle state are captured when available.
103+
- Event queue storage uses `@react-native-async-storage/async-storage`.
104+
105+
## Troubleshooting
106+
107+
- If native crashes do not appear in Expo, verify the app is not running in Expo Go and that the config plugin is present before rebuilding the native app.
108+
- If simulator submissions cannot reach a local Exceptionless server, use `http://localhost:<port>` for iOS Simulator. Physical devices need a reachable LAN host.
109+
- For malformed or unexpected stacks, verify behavior in `ReactNativeErrorPlugin` tests before changing parser logic.
110+
- For native crash report loss concerns, verify `NativeCrashPlugin` only clears pending reports after at least one report is retrieved and submitted.
111+
112+
## Source Anchors
113+
114+
- `packages/react-native/README.md`
115+
- `packages/react-native/src/ReactNativeExceptionlessClient.ts`
116+
- `packages/react-native/src/ExceptionlessErrorBoundary.tsx`
117+
- `packages/react-native/src/plugins/ReactNativeErrorPlugin.ts`
118+
- `packages/react-native/src/plugins/ReactNativeGlobalHandlerPlugin.ts`
119+
- `packages/react-native/src/plugins/ReactNativeLifeCyclePlugin.ts`
120+
- `packages/react-native/src/plugins/NativeCrashPlugin.ts`
121+
- `packages/react-native/src/storage/AsyncStorageProvider.ts`
122+
- `packages/react-native/exceptionless-react-native.podspec`
123+
- `packages/react-native/expo-plugin/withExceptionless.cjs`
124+
- `example/expo/`

0 commit comments

Comments
 (0)