Skip to content

Commit 1984b1c

Browse files
committed
chore: update version to 3.2.9 and enhance README with user and context management examples
1 parent a2d7026 commit 1984b1c

2 files changed

Lines changed: 39 additions & 2 deletions

File tree

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,47 @@ const hawk = new HawkCatcher({token: 'INTEGRATION_TOKEN'});
106106

107107
// somewhere in try-catch block or other custom place
108108
hawk.send(new Error('Something went wrong'), {
109-
myOwnDebugInfo: '1234'
109+
myOwnDebugInfo: '1234',
110110
});
111111
```
112112
113+
## User Management
114+
115+
You can dynamically manage user information after the catcher is initialized:
116+
117+
```js
118+
const hawk = new HawkCatcher({ token: 'INTEGRATION_TOKEN' });
119+
120+
// Set user information
121+
hawk.setUser({
122+
id: 'user123',
123+
name: 'John Doe',
124+
url: '/users/123',
125+
image: 'https://example.com/avatar.jpg',
126+
});
127+
128+
// Clear user (revert to generated user)
129+
hawk.clearUser();
130+
```
131+
132+
## Context Management
133+
134+
You can dynamically update context data that will be sent with all events:
135+
136+
```js
137+
const hawk = new HawkCatcher({ token: 'INTEGRATION_TOKEN' });
138+
139+
// Set context data
140+
hawk.setContext({
141+
feature: 'user-dashboard',
142+
version: '2.1.0',
143+
environment: 'production',
144+
});
145+
146+
// Clear context data
147+
hawk.clearContext();
148+
```
149+
113150
## Source maps consuming
114151
115152
If your bundle is minified, it is useful to pass source-map files to the Hawk. After that you will see beautiful original source code lines in Hawk Garage instead of minified code.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@hawk.so/javascript",
33
"type": "commonjs",
4-
"version": "3.2.8",
4+
"version": "3.2.9",
55
"description": "JavaScript errors tracking for Hawk.so",
66
"files": [
77
"dist"

0 commit comments

Comments
 (0)