Skip to content

Commit 9be5546

Browse files
author
Andrew E. Rhyne
committedDec 7, 2016
Release 1.2.0
1 parent 5196476 commit 9be5546

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed
 

‎CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
1.1.0 / 2016-12-01
1+
2+
1.2.0 / 2016-12-07
23
==================
3-
* Added option to show original locations and paths in error (#1, @scf4)
4+
* Added option to override message when throwing error (@thebigredgeek)
45

56
1.1.0 / 2016-12-01
67
==================
7-
8-
* Added option to show original locations and paths in error
8+
* Added option to show original locations and paths in error (#1, @scf4)
99

1010
1.0.2 / 2016-11-11
1111
==================

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ Witness glorious simplicity:
8181

8282
## API
8383

84-
### ApolloError ({ [time_thrown: String, data: Object]})
84+
### ApolloError ({ [time_thrown: String, data: Object, message: String ]})
8585

8686
Creates a new ApolloError object. Note that `ApolloError` in this context refers
8787
to an error class created and returned by `createError` documented below. Error can be
88-
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).
88+
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`).
8989

9090

9191
### createError(name, {message: String, [data: Object, options: Object]}): ApolloError

‎dist/index.js

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apollo-errors",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Machine-readable custom errors for Apollostack's GraphQL server",
55
"main": "dist/index.js",
66
"scripts": {

‎src/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ApolloError extends ExtendableError {
1616
}) {
1717
const t = (arguments[2] && arguments[2].thrown_at) || time_thrown;
1818
const d = Object.assign({}, data, ((arguments[2] && arguments[2].data) || {}));
19+
const m = (arguments[2] && arguments[2].message) || message;
1920
const opts = Object.assign({}, options, ((arguments[2] && arguments[2].options) || {}));
2021

2122
super(serializeName([
@@ -27,7 +28,7 @@ class ApolloError extends ExtendableError {
2728
]));
2829

2930
this._name = name;
30-
this._humanized_message = message || '';
31+
this._humanized_message = m || '';
3132
this._time_thrown = t;
3233
this._data = d;
3334
this._locations = (opts.showLocations && arguments[2] && arguments[2].locations)

‎test/spec.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe('createError', () => {
1818
const iso = new Date().toISOString();
1919

2020
const e = new FooError({
21+
message: 'A foo 2.0 error has occurred',
2122
data: {
2223
foo: 'bar'
2324
},
@@ -29,7 +30,7 @@ describe('createError', () => {
2930

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

32-
expect(message).to.equal('A foo error has occurred');
33+
expect(message).to.equal('A foo 2.0 error has occurred');
3334
expect(name).to.equal('FooError');
3435
expect(time_thrown).to.equal(e._time_thrown);
3536
expect(data).to.eql({

0 commit comments

Comments
 (0)
Please sign in to comment.