Skip to content

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew E. Rhyne committed Dec 7, 2016
1 parent 5196476 commit 9be5546
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
1.1.0 / 2016-12-01

1.2.0 / 2016-12-07
==================
* Added option to show original locations and paths in error (#1, @scf4)
* Added option to override message when throwing error (@thebigredgeek)

1.1.0 / 2016-12-01
==================

* Added option to show original locations and paths in error
* Added option to show original locations and paths in error (#1, @scf4)

1.0.2 / 2016-11-11
==================
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ Witness glorious simplicity:

## API

### ApolloError ({ [time_thrown: String, data: Object]})
### ApolloError ({ [time_thrown: String, data: Object, message: String ]})

Creates a new ApolloError object. Note that `ApolloError` in this context refers
to an error class created and returned by `createError` documented below. Error can be
initialized with a custom `time_thrown` ISODate (default is current ISODate) and `data` object (which will be merged with data specified through `createError`, if it exists).
initialized with a custom `time_thrown` ISODate (default is current ISODate), `data` object (which will be merged with data specified through `createError`, if it exists), and `message` (which will override the message specified through `createError`).


### createError(name, {message: String, [data: Object, options: Object]}): ApolloError
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo-errors",
"version": "1.1.0",
"version": "1.2.0",
"description": "Machine-readable custom errors for Apollostack's GraphQL server",
"main": "dist/index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ApolloError extends ExtendableError {
}) {
const t = (arguments[2] && arguments[2].thrown_at) || time_thrown;
const d = Object.assign({}, data, ((arguments[2] && arguments[2].data) || {}));
const m = (arguments[2] && arguments[2].message) || message;
const opts = Object.assign({}, options, ((arguments[2] && arguments[2].options) || {}));

super(serializeName([
Expand All @@ -27,7 +28,7 @@ class ApolloError extends ExtendableError {
]));

this._name = name;
this._humanized_message = message || '';
this._humanized_message = m || '';
this._time_thrown = t;
this._data = d;
this._locations = (opts.showLocations && arguments[2] && arguments[2].locations)
Expand Down
3 changes: 2 additions & 1 deletion test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('createError', () => {
const iso = new Date().toISOString();

const e = new FooError({
message: 'A foo 2.0 error has occurred',
data: {
foo: 'bar'
},
Expand All @@ -29,7 +30,7 @@ describe('createError', () => {

const { message, name, time_thrown, data } = e.serialize();

expect(message).to.equal('A foo error has occurred');
expect(message).to.equal('A foo 2.0 error has occurred');
expect(name).to.equal('FooError');
expect(time_thrown).to.equal(e._time_thrown);
expect(data).to.eql({
Expand Down

0 comments on commit 9be5546

Please sign in to comment.