Skip to content

Commit

Permalink
Merge pull request #40 from thebigredgeek/revert-35-lxcid/spec-compliant
Browse files Browse the repository at this point in the history
Revert "Make serialized error spec compliant"
  • Loading branch information
thebigredgeek authored Apr 11, 2018
2 parents 76508ce + 2df269a commit f8c0b8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ export interface ErrorConfig {

export interface ErrorInfo {
message: string;
name: string;
time_thrown: string;
data?: object;
path?: string;
locations?: any;
extensions?: {
name: string;
time_thrown: string;
data?: object;
};
}

export class ApolloError extends ExtendableError {
Expand Down Expand Up @@ -64,13 +62,11 @@ export class ApolloError extends ExtendableError {

let error: ErrorInfo = {
message,
name,
time_thrown,
data,
path,
locations,
extensions: {
name,
time_thrown,
data
}
locations
};

if (_showLocations) {
Expand Down
2 changes: 1 addition & 1 deletion test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('createError', () => {
},
});

const { message, extensions: { name, time_thrown, data } } = e.serialize();
const { message, name, time_thrown, data } = e.serialize();
expect(message).to.equal('A foo 2.0 error has occurred');
expect(name).to.equal('FooError');
expect(time_thrown).to.equal(e.time_thrown);
Expand Down

0 comments on commit f8c0b8c

Please sign in to comment.