@getexception/browser 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 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,70 @@
1
+ # @getexception/browser
2
+
3
+ Browser error monitoring for your own GetException server. Captures unhandled exceptions and promise rejections, and provides a small API for reporting handled errors.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ yarn add --exact @getexception/browser
9
+ ```
10
+
11
+ For React applications, install [`@getexception/react`](https://www.npmjs.com/package/@getexception/react) instead; it includes the browser SDK and a React `ErrorBoundary`.
12
+
13
+ ## Initialize
14
+
15
+ Create a project in GetException, configure its **Allowed origins**, and save the DSN. Initialize once in the browser entry point. With Vite:
16
+
17
+ ```ts
18
+ import * as GetException from "@getexception/browser";
19
+
20
+ GetException.init({
21
+ dsn: import.meta.env.VITE_GETEXCEPTION_DSN,
22
+ environment: "production",
23
+ });
24
+
25
+ GetException.captureException(new Error("GetException connection test"));
26
+ ```
27
+
28
+ Use your installation's separate HTTPS ingest domain in the DSN. It must resolve and have a valid certificate before errors can reach the server. Add the ingest origin to CSP `connect-src` if your application uses CSP. The DSN is a public, write-only project key and does not grant access to the dashboard.
29
+
30
+ ## Configuration
31
+
32
+ | Option | Meaning |
33
+ | ------------- | --------------------------------------------------------------------- |
34
+ | `dsn` | Required HTTPS project DSN from GetException. |
35
+ | `environment` | `production`, `staging` or `development` (default). |
36
+ | `release` | Optional `<project-slug>@<full 40-character Git SHA>`. |
37
+ | `dist` | Optional build identifier, up to 64 letters, digits, `.`, `_` or `-`. |
38
+ | `enabled` | Set to `false` to skip initialization. |
39
+
40
+ Importing the package does not initialize monitoring. Invalid configuration disables sending without throwing into the application. Calling `init` again while the client is active does nothing; use `close` before initializing another client.
41
+
42
+ ## Manual capture and context
43
+
44
+ ```ts
45
+ GetException.withScope((scope) => {
46
+ scope.setTag("feature", "editor");
47
+ scope.setTag("operation", "save");
48
+ scope.setContext("app", { route: "/documents" });
49
+ GetException.captureException(new Error("Document save failed"));
50
+ });
51
+
52
+ GetException.captureMessage("Upload failed", "error");
53
+ await GetException.flush(1500);
54
+ ```
55
+
56
+ `captureException` and `captureMessage` return an event ID, or an empty string when inactive. An event ID does not confirm delivery. `captureMessage` supports only `error` and `fatal`. `flush` waits for local work to finish; it does not guarantee acceptance or processing by the server. `close` shuts down the client. Both return `Promise<boolean>` and cap waiting at two seconds.
57
+
58
+ Tags are limited to `feature`, `component` and `operation`. Context is limited to `app.route`, with query strings and fragments removed. Manual breadcrumbs support `navigation`, `http` and `manual` with allowed fields only. See the [compatibility guide](https://github.com/GetException/GetException/blob/stable/docs/sdk-compatibility.md) before replacing Sentry imports through npm aliases.
59
+
60
+ ## Privacy and scope
61
+
62
+ The client uses a restricted Sentry integration and cleans event data before sending. The server independently validates and cleans it again. Requests omit cookies and referrers. Network failures do not throw into your application; the client limits pending requests and backs off after HTTP 429.
63
+
64
+ No replay, tracing, user identity, automatic console/DOM breadcrumbs, cookies, form data, local storage, attachments or arbitrary context are collected. Avoid putting credentials or personal data in error messages. Source map upload and symbolication are not yet implemented.
65
+
66
+ This package targets modern browsers, is ESM and includes TypeScript declarations. It is not a Node.js SDK.
67
+
68
+ ## License
69
+
70
+ 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.
@@ -0,0 +1,34 @@
1
+ type SeverityLevel = "error" | "fatal";
2
+ interface BrowserOptions {
3
+ dsn: string;
4
+ release?: string;
5
+ environment?: "production" | "staging" | "development";
6
+ dist?: string;
7
+ enabled?: boolean;
8
+ }
9
+ interface Breadcrumb {
10
+ category?: string;
11
+ timestamp?: number;
12
+ data?: Record<string, unknown>;
13
+ }
14
+ interface Scope {
15
+ setTag(key: string, value: string | number | boolean): void;
16
+ setTags(tags: Record<string, string | number | boolean>): void;
17
+ setContext(name: string, context: Record<string, unknown> | null): void;
18
+ addBreadcrumb(breadcrumb: Breadcrumb): void;
19
+ }
20
+ declare function dsnEndpoint(dsn: string): string;
21
+ /** Unsupported options are ignored; only this allow-list is ever passed to Sentry. */
22
+ declare function init(options?: BrowserOptions): void;
23
+ declare function captureException(exception: unknown): string;
24
+ /** Unsupported levels explicitly produce no event and return an empty ID. */
25
+ declare function captureMessage(message: string, level?: SeverityLevel): string;
26
+ declare function setTag(key: string, value: string | number | boolean): void;
27
+ declare function setTags(tags: Record<string, string | number | boolean>): void;
28
+ declare function setContext(name: string, context: Record<string, unknown> | null): void;
29
+ declare function addBreadcrumb(breadcrumb: Breadcrumb): void;
30
+ declare function withScope<T>(callback: (scope: Scope) => T): T;
31
+ declare function flush(timeout?: number): Promise<boolean>;
32
+ declare function close(timeout?: number): Promise<boolean>;
33
+
34
+ export { type Breadcrumb, type BrowserOptions, type Scope, type SeverityLevel, addBreadcrumb, captureException, captureMessage, close, dsnEndpoint, flush, init, setContext, setTag, setTags, withScope };