File tree Expand file tree Collapse file tree 7 files changed +35
-6
lines changed Expand file tree Collapse file tree 7 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ Initialization settings:
72
72
| ` context` | object | optional | Any data you want to pass with every message . Has limitation of length. |
73
73
| ` vue` | Vue constructor | optional | Pass Vue constructor to set up the [Vue integration](#integrate - to - vue - application ) |
74
74
| `disableGlobalErrorsHandling` | boolean | optional | Do not initialize global errors handling |
75
+ | `disableVueErrorHandler` | boolean | optional | Do not initialize Vue errors handling |
75
76
| `beforeSend` | function(event) => event | optional | This Method allows you to filter any data you don't want sending to Hawk |
76
77
77
78
Other available [initial settings](types/hawk-initial-settings.d.ts) are described at the type definition.
Original file line number Diff line number Diff line change @@ -228,11 +228,11 @@ <h2>Test Vue integration: <test-component></h2>
228
228
< script >
229
229
window . hawk = new HawkCatcher ( {
230
230
token : 'eyJpbnRlZ3JhdGlvbklkIjoiNWU5OTE1MzItZTdiYy00ZjA0LTliY2UtYmIzZmE5ZTUwMTg3Iiwic2VjcmV0IjoiMTBlMTA4MjQtZTcyNC00YWFkLTkwMDQtMzExYTU1OWMzZTIxIn0=' ,
231
- collectorEndpoint : 'ws://localhost:3000/ws' ,
231
+ // collectorEndpoint: 'ws://localhost:3000/ws',
232
232
vue : window . Vue ,
233
233
context : {
234
234
rootContextSample : '12345'
235
- }
235
+ } ,
236
236
} )
237
237
</ script >
238
238
</ body >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @hawk.so/javascript" ,
3
- "version" : " 3.0.8 " ,
3
+ "version" : " 3.0.9 " ,
4
4
"description" : " JavaScript errors tracking for Hawk.so" ,
5
5
"main" : " ./dist/hawk.js" ,
6
6
"types" : " ./dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ export default class Catcher {
81
81
*/
82
82
private readonly stackParser : StackParser = new StackParser ( ) ;
83
83
84
+ /**
85
+ * Disable Vue.js error handler
86
+ */
87
+ private readonly disableVueErrorHandler : boolean = false ;
88
+
84
89
/**
85
90
* Catcher constructor
86
91
*
@@ -99,6 +104,7 @@ export default class Catcher {
99
104
this . user = settings . user || Catcher . getGeneratedUser ( ) ;
100
105
this . context = settings . context || undefined ;
101
106
this . beforeSend = settings . beforeSend ;
107
+ this . disableVueErrorHandler = settings . disableVueErrorHandler ?? false ;
102
108
103
109
if ( ! this . token ) {
104
110
log (
@@ -188,6 +194,8 @@ export default class Catcher {
188
194
this . formatAndSend ( error , {
189
195
vue : addons ,
190
196
} ) ;
197
+ } , {
198
+ disableVueErrorHandler : this . disableVueErrorHandler ,
191
199
} ) ;
192
200
}
193
201
Original file line number Diff line number Diff line change 1
1
import Sanitizer from './../modules/sanitizer' ;
2
2
import { VueIntegrationAddons } from '@hawk.so/types' ;
3
3
4
+ interface VueIntegrationOptions {
5
+ /**
6
+ * Disable Vue.js error handler
7
+ *
8
+ * Used by @hawk.so/nuxt since Nuxt has own error hook.
9
+ * Otherwise, Nuxt will show 500 error
10
+ */
11
+ disableVueErrorHandler ?: boolean ;
12
+ }
13
+
4
14
/**
5
15
* Errors fired inside Vue components are not dispatched by global handlers.
6
16
* This integration allow us to set up own error handler
@@ -28,13 +38,16 @@ export class VueIntegration {
28
38
*
29
39
* @param vue - Vue app to handle
30
40
* @param callback - callback that accepts new error
41
+ * @param options - additional options
31
42
*/
32
- constructor ( vue , callback ) {
43
+ constructor ( vue , callback , options : VueIntegrationOptions ) {
33
44
this . vue = vue ;
34
45
this . existedHandler = vue . config . errorHandler ;
35
46
this . callback = callback ;
36
47
37
- this . setupHandler ( ) ;
48
+ if ( options . disableVueErrorHandler !== true ) {
49
+ this . setupHandler ( ) ;
50
+ }
38
51
}
39
52
40
53
/**
Original file line number Diff line number Diff line change @@ -65,4 +65,11 @@ export interface HawkInitialSettings {
65
65
* This Method allows you to filter any data you don't want sending to Hawk
66
66
*/
67
67
beforeSend ?( event : HawkJavaScriptEvent ) : HawkJavaScriptEvent ;
68
+
69
+ /**
70
+ * Disable Vue.js error handler
71
+ *
72
+ * Used by @hawk.so/nuxt since Nuxt has own error hook.
73
+ */
74
+ disableVueErrorHandler ?: boolean ;
68
75
}
Original file line number Diff line number Diff line change 1
1
2
- Size: 7.44 KB with all dependencies, minified and gzipped
2
+ Size: 7.5 KB with all dependencies, minified and gzipped
3
3
You can’t perform that action at this time.
0 commit comments