@getexception/react 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/THIRD-PARTY-NOTICES.md +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +27 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GetException contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @getexception/react
|
|
2
|
+
|
|
3
|
+
Error monitoring for React 18 and 19 applications using your own GetException server. Includes automatic browser error capture, manual capture and a React `ErrorBoundary`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
yarn add --exact @getexception/react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The browser SDK is installed automatically. This package is for browser applications; it does not provide a Node.js or Next.js server SDK.
|
|
12
|
+
|
|
13
|
+
## Connect your application
|
|
14
|
+
|
|
15
|
+
Create a project in the GetException dashboard, add your application's origin to **Allowed origins**, and save the DSN shown when the project is created. The DSN must use the installation's separate HTTPS ingest domain.
|
|
16
|
+
|
|
17
|
+
Initialize once in your application entry point, before rendering React. With Vite:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { createRoot } from "react-dom/client";
|
|
21
|
+
import * as GetException from "@getexception/react";
|
|
22
|
+
import { App } from "./App";
|
|
23
|
+
|
|
24
|
+
GetException.init({
|
|
25
|
+
dsn: import.meta.env.VITE_GETEXCEPTION_DSN,
|
|
26
|
+
environment: "production",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
createRoot(document.getElementById("root")!).render(
|
|
30
|
+
<GetException.ErrorBoundary fallback={<p>Something went wrong.</p>}>
|
|
31
|
+
<App />
|
|
32
|
+
</GetException.ErrorBoundary>,
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Put the DSN in your application's environment configuration. It is a public, write-only project key, not a dashboard password. If your application uses a Content Security Policy, allow the ingest origin in `connect-src`.
|
|
37
|
+
|
|
38
|
+
`ErrorBoundary` captures errors while rendering its children and shows your fallback. Unhandled browser errors and promise rejections are captured after `init`. For errors handled by your own code:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
try {
|
|
42
|
+
await saveDocument();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
GetException.captureException(error);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
To check the connection, call `GetException.captureException(new Error("GetException connection test"))` and look for the issue in your project. The ingest domain must resolve and have a valid HTTPS certificate. Local SDK tests do not require your production ingest DNS.
|
|
49
|
+
|
|
50
|
+
## Supported API
|
|
51
|
+
|
|
52
|
+
`init`, `captureException`, `captureMessage`, `setTag`, `setTags`, `setContext`, `addBreadcrumb`, `withScope`, `flush`, `close`, and `ErrorBoundary`. See the [browser SDK](https://www.npmjs.com/package/@getexception/browser) for configuration and the [compatibility guide](https://github.com/GetException/GetException/blob/stable/docs/sdk-compatibility.md) for exact limits.
|
|
53
|
+
|
|
54
|
+
The SDK uses a restricted Sentry integration. It sends errors only: no replay, tracing, automatic console/DOM breadcrumbs, cookies, form values or user identity. Tags and context use an allow-list. Source map upload and symbolication are not yet implemented, so production stack traces may refer to bundled code.
|
|
55
|
+
|
|
56
|
+
React is a peer dependency and stays under the application's control. Importing the package does not start monitoring; call `init` explicitly. The package is ESM and includes TypeScript declarations.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT. See `THIRD-PARTY-NOTICES.md` for the underlying Sentry SDK and bundled dependencies.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The SDK uses the official MIT-licensed Sentry JavaScript SDK 10.73.0, copyright
|
|
4
|
+
Sentry and contributors. Its npm dependencies retain their original LICENSE files.
|
|
5
|
+
The browser bundle includes GetException protocol (MIT) and Zod (MIT),
|
|
6
|
+
copyright Colin McDonnell and contributors. The MIT permission and warranty
|
|
7
|
+
notice is reproduced in LICENSE and applies to these bundled portions as well.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// packages/react/src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
init,
|
|
4
|
+
captureException,
|
|
5
|
+
captureMessage,
|
|
6
|
+
setTag,
|
|
7
|
+
setTags,
|
|
8
|
+
setContext,
|
|
9
|
+
addBreadcrumb,
|
|
10
|
+
withScope,
|
|
11
|
+
flush,
|
|
12
|
+
close
|
|
13
|
+
} from "@getexception/browser";
|
|
14
|
+
import { ErrorBoundary } from "@getexception/sentry-react";
|
|
15
|
+
export {
|
|
16
|
+
ErrorBoundary,
|
|
17
|
+
addBreadcrumb,
|
|
18
|
+
captureException,
|
|
19
|
+
captureMessage,
|
|
20
|
+
close,
|
|
21
|
+
flush,
|
|
22
|
+
init,
|
|
23
|
+
setContext,
|
|
24
|
+
setTag,
|
|
25
|
+
setTags,
|
|
26
|
+
withScope
|
|
27
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getexception/react",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "GetException error monitoring and ErrorBoundary for React 18 and 19",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"THIRD-PARTY-NOTICES.md"
|
|
15
|
+
],
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@getexception/browser": "0.1.2",
|
|
26
|
+
"@getexception/sentry-react": "npm:@sentry/react@10.73.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/react": "18.3.31",
|
|
30
|
+
"react": "18.3.1"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/GetException/GetException.git",
|
|
38
|
+
"directory": "packages/react"
|
|
39
|
+
}
|
|
40
|
+
}
|