File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export class ApolloError extends ExtendableError {
29
29
message : string ;
30
30
time_thrown : string ;
31
31
data : object ;
32
+ internalData : object ;
32
33
path : any ;
33
34
locations : any ;
34
35
_showLocations : boolean = false ;
@@ -43,8 +44,11 @@ export class ApolloError extends ExtendableError {
43
44
const t = ( ctorConfig && ctorConfig . time_thrown ) || ( config && config . time_thrown ) || ( new Date ( ) ) . toISOString ( ) ;
44
45
const m = ( ctorConfig && ctorConfig . message ) || ( config && config . message ) || '' ;
45
46
const ctorData = ( ctorConfig && ctorConfig . data ) || { } ;
47
+ const ctorInternalData = ( ctorConfig && ctorConfig . internalData ) || { }
46
48
const configData = ( config && config . data ) || { } ;
49
+ const configInternalData = ( config && config . internalData ) || { }
47
50
const d = { ...this . data , ...configData , ...ctorData } ;
51
+ const id = { ...this . internalData , ...configInternalData , ...ctorInternalData }
48
52
const ctorOptions = ( ctorConfig && ctorConfig . options ) || { } ;
49
53
const configOptions = ( config && config . options ) || { } ;
50
54
const opts = { ...configOptions , ...ctorOptions } ;
@@ -54,6 +58,7 @@ export class ApolloError extends ExtendableError {
54
58
this . message = m ;
55
59
this . time_thrown = t ;
56
60
this . data = d ;
61
+ this . internalData = id ;
57
62
this . _showLocations = ! ! opts . showLocations ;
58
63
this . _showPath = ! ! opts . showPath ;
59
64
}
Original file line number Diff line number Diff line change @@ -147,6 +147,9 @@ describe('formatError', () => {
147
147
} ) ;
148
148
149
149
const e = new FooError ( ) ;
150
+ expect ( e . internalData ) . to . to . eql ( {
151
+ secret : 'SQL ERROR'
152
+ } )
150
153
const s = formatError ( e ) ;
151
154
expect ( s . internalData ) . to . eq ( undefined )
152
155
} )
You can’t perform that action at this time.
0 commit comments