Skip to content

Commit f31904c

Browse files
committed
feat(svelte-integration): hawk catcher added in svelte playground
1 parent 680141a commit f31904c

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Test playground for Hawk Error Tracker integration with SvelteKit and Svelte.
55
## Table of Contents
66

77
- [Getting Started](#getting-started)
8+
- [Hawk Integration](#hawk-integration)
89

910
## Getting Started
1011

@@ -21,3 +22,22 @@ yarn install
2122
```shell
2223
yarn dev
2324
```
25+
26+
## Hawk Integration
27+
28+
Current integration in `hooks.client.ts`:
29+
30+
```typescript
31+
import Hawk from '@hawk.so/svelte';
32+
33+
if (import.meta.env.VITE_HAWK_TOKEN) {
34+
new Hawk({
35+
token: import.meta.env.VITE_HAWK_TOKEN
36+
});
37+
}
38+
```
39+
40+
Hawk automatically registers global error handlers for:
41+
42+
- `window.onerror`
43+
- `window.onunhandledrejection`
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Hawk from '@hawk.so/svelte';
2+
3+
if (import.meta.env.VITE_HAWK_TOKEN) {
4+
new Hawk({
5+
token: import.meta.env.VITE_HAWK_TOKEN,
6+
});
7+
}

0 commit comments

Comments
 (0)