Skip to content

Commit 779f6f4

Browse files
committed
feat(svelte-integration): hawk catcher added in svelte playground
1 parent 8f7960d commit 779f6f4

File tree

5 files changed

+690
-7
lines changed

5 files changed

+690
-7
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_HAWK_TOKEN=your_integration_token_here

packages/svelte/playground/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,25 @@ yarn install
2121
```shell
2222
yarn dev
2323
```
24+
25+
## Integration
26+
27+
Current integration in `hooks.client.ts`:
28+
29+
```typescript
30+
import HawkCatcher from '@hawk.so/javascript';
31+
32+
if (import.meta.env.VITE_HAWK_TOKEN) {
33+
new HawkCatcher({
34+
token: import.meta.env.VITE_HAWK_TOKEN
35+
});
36+
}
37+
```
38+
39+
Hawk automatically registers global error handlers for:
40+
41+
- `window.onerror`
42+
- `window.onunhandledrejection`
43+
44+
**Note:** HawkCatcher is browser-only and cannot run on the server (uses `localStorage`, `window`, etc.). Server-side
45+
errors are not tracked automatically.

packages/svelte/playground/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "hawk-svelte-playground",
3+
"private": true,
34
"version": "1.0.0",
45
"description": "SvelteKit playground for testing Hawk.so error handling integration",
56
"type": "module",
@@ -8,6 +9,9 @@
89
"build": "vite build",
910
"preview": "vite preview"
1011
},
12+
"dependencies": {
13+
"@hawk.so/javascript": "*"
14+
},
1115
"devDependencies": {
1216
"@sveltejs/kit": "^2.48.5",
1317
"@sveltejs/vite-plugin-svelte": "^6.2.1",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import HawkCatcher from '@hawk.so/javascript';
2+
3+
if (import.meta.env.VITE_HAWK_TOKEN) {
4+
new HawkCatcher({
5+
token: import.meta.env.VITE_HAWK_TOKEN
6+
});
7+
}

0 commit comments

Comments
 (0)