Skip to content

Commit f8c0b8c

Browse files
Merge pull request #40 from thebigredgeek/revert-35-lxcid/spec-compliant
Revert "Make serialized error spec compliant"
2 parents 76508ce + 2df269a commit f8c0b8c

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/index.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ export interface ErrorConfig {
1616

1717
export interface ErrorInfo {
1818
message: string;
19+
name: string;
20+
time_thrown: string;
21+
data?: object;
1922
path?: string;
2023
locations?: any;
21-
extensions?: {
22-
name: string;
23-
time_thrown: string;
24-
data?: object;
25-
};
2624
}
2725

2826
export class ApolloError extends ExtendableError {
@@ -64,13 +62,11 @@ export class ApolloError extends ExtendableError {
6462

6563
let error: ErrorInfo = {
6664
message,
65+
name,
66+
time_thrown,
67+
data,
6768
path,
68-
locations,
69-
extensions: {
70-
name,
71-
time_thrown,
72-
data
73-
}
69+
locations
7470
};
7571

7672
if (_showLocations) {

test/spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('createError', () => {
3131
},
3232
});
3333

34-
const { message, extensions: { name, time_thrown, data } } = e.serialize();
34+
const { message, name, time_thrown, data } = e.serialize();
3535
expect(message).to.equal('A foo 2.0 error has occurred');
3636
expect(name).to.equal('FooError');
3737
expect(time_thrown).to.equal(e.time_thrown);

0 commit comments

Comments
 (0)