Skip to content

Commit 2c45d6f

Browse files
authored
Add disableGlobalErrorsHandling option (#53)
1 parent f8d8dd2 commit 2c45d6f

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Initialization settings:
7676
| `user` | {id: string, name?: string, image?: string, url?: string} | optional | Current authenticated user |
7777
| `context` | object | optional | Any data you want to pass with every message. |
7878
| `vue` | Vue constructor | optional | Pass Vue constructor to set up the [Vue integration](#integrate-to-vue-application) |
79+
| `disableGlobalErrorsHandling` | boolean | optional | Do not initialize global errors handling |
7980

8081
Other available [initial settings](types/hawk-initial-settings.d.ts) are described at the type definition.
8182

dist/hawk.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hawk.so/javascript",
3-
"version": "2.5.0",
3+
"version": "2.6.0",
44
"description": "JavaScript errors tracking for Hawk.so",
55
"main": "./dist/hawk.js",
66
"types": "./dist/index.d.ts",

src/catcher.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ export default class Catcher {
102102
});
103103

104104
/**
105-
* Set handlers
105+
* Set gloabal handlers
106106
*/
107-
this.initGlobalHandlers();
107+
if (!settings.disableGlobalErrorsHandling) {
108+
this.initGlobalHandlers();
109+
}
108110

109111
if (settings.vue) {
110112
this.connectVue(settings.vue);

stats.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
Size: 7.1 KB with all dependencies, minified and gzipped
2+
Size: 7.11 KB with all dependencies, minified and gzipped
33

types/hawk-initial-settings.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ export interface HawkInitialSettings {
4848
* to handle its errors
4949
*/
5050
vue?: any;
51+
52+
/**
53+
* Do not initialize global errors handling
54+
* This options still allow you send events manually
55+
*/
56+
disableGlobalErrorsHandling?: boolean;
5157
}
5258

5359
export {

0 commit comments

Comments
 (0)