File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,10 +106,47 @@ const hawk = new HawkCatcher({token: 'INTEGRATION_TOKEN'});
106106
107107// somewhere in try-catch block or other custom place
108108hawk .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
115152If 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.
Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments