Skip to content

Commit 11e98cc

Browse files
authored
Set error config properly.
The constructor ApolloError is failing to get the config argument. It is trying to get it from the 3rd position of the arguments object: (arguments[2]). It should be accessing it from the 2nd position: (arguments[1]).
1 parent b7e8814 commit 11e98cc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ export class ApolloError extends ExtendableError {
3434
_showPath: boolean = false;
3535

3636
constructor(name: string, config: ErrorConfig) {
37-
super((arguments[2] && arguments[2].message) || '');
37+
super((arguments[1] && arguments[1].message) || '');
3838

39-
const t = (arguments[2] && arguments[2].time_thrown) || (new Date()).toISOString();
40-
const m = (arguments[2] && arguments[2].message) || '';
41-
const configData = (arguments[2] && arguments[2].data) || {};
39+
const t = (arguments[1] && arguments[1].time_thrown) || (new Date()).toISOString();
40+
const m = (arguments[1] && arguments[1].message) || '';
41+
const configData = (arguments[1] && arguments[1].data) || {};
4242
const d = { ...this.data, ...configData };
43-
const opts = ((arguments[2] && arguments[2].options) || {});
43+
const opts = ((arguments[1] && arguments[1].options) || {});
4444

4545

4646
this.name = name;

0 commit comments

Comments
 (0)