Skip to content

Commit 76508ce

Browse files
Merge pull request #37 from lxcid/lxcid/merging
Rename ctorData to ctorConfig
2 parents 47a8e67 + b7fdcd9 commit 76508ce

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Diff for: src/index.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@ export class ApolloError extends ExtendableError {
3838
// NOTE: The object passed to the Constructor is actually `ctorData`.
3939
// We are binding the constructor to the name and config object
4040
// for the first two parameters inside of `createError`
41-
constructor(name: string, config: ErrorConfig, ctorData: any) {
42-
super((ctorData && ctorData.message) || '');
43-
44-
const t = (ctorData && ctorData.time_thrown) || (new Date()).toISOString();
45-
const m = (ctorData && ctorData.message) || '';
46-
const configData = (ctorData && ctorData.data) || {};
47-
const d = { ...this.data, ...configData };
48-
const opts = ((ctorData && ctorData.options) || {});
41+
constructor(name: string, config: ErrorConfig, ctorConfig: ErrorConfig) {
42+
super((ctorConfig && ctorConfig.message) || (config && config.message) || '');
43+
44+
const t = (ctorConfig && ctorConfig.time_thrown) || (config && config.time_thrown) || (new Date()).toISOString();
45+
const m = (ctorConfig && ctorConfig.message) || (config && config.message) || '';
46+
const ctorData = (ctorConfig && ctorConfig.data) || {};
47+
const configData = (config && config.data) || {};
48+
const d = { ...this.data, ...configData, ...ctorData };
49+
const ctorOptions = (ctorConfig && ctorConfig.options) || {};
50+
const configOptions = (config && config.options) || {};
51+
const opts = { ...configOptions, ...ctorOptions };
4952

5053

5154
this.name = name;

0 commit comments

Comments
 (0)