Skip to content

Commit 50da5d3

Browse files
Add dots at the end of error messages (#2307)
1 parent 390000e commit 50da5d3

21 files changed

+29
-28
lines changed

src/execution/__tests__/executor-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('Execute: Handles basic execution tasks', () => {
3232
});
3333

3434
// $DisableFlowOnNegativeTest
35-
expect(() => execute({ schema })).to.throw('Must provide document');
35+
expect(() => execute({ schema })).to.throw('Must provide document.');
3636
});
3737

3838
it('throws if no schema is provided', () => {

src/execution/execute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export function assertValidExecutionArguments(
251251
document: DocumentNode,
252252
rawVariableValues: ?{ +[variable: string]: mixed, ... },
253253
): void {
254-
devAssert(document, 'Must provide document');
254+
devAssert(document, 'Must provide document.');
255255

256256
// If the schema used for execution is invalid, throw an error.
257257
assertValidSchema(schema);

src/jsutils/invariant.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function invariant(condition: mixed, message?: string): void {
44
const booleanCondition = Boolean(condition);
55
if (!booleanCondition) {
66
throw new Error(
7-
message != null ? message : 'Unexpected invariant triggered',
7+
message != null ? message : 'Unexpected invariant triggered.',
88
);
99
}
1010
}

src/language/__tests__/parser-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ function expectSyntaxError(text) {
2323
describe('Parser', () => {
2424
it('asserts that a source to parse was provided', () => {
2525
// $DisableFlowOnNegativeTest
26-
expect(() => parse()).to.throw('Must provide Source. Received: undefined');
26+
expect(() => parse()).to.throw('Must provide Source. Received: undefined.');
2727
});
2828

2929
it('asserts that an invalid source to parse was provided', () => {
3030
// $DisableFlowOnNegativeTest
31-
expect(() => parse({})).to.throw('Must provide Source. Received: {}');
31+
expect(() => parse({})).to.throw('Must provide Source. Received: {}.');
3232
});
3333

3434
it('parse provides useful errors', () => {

src/language/__tests__/printer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Printer: Query document', () => {
2727
const badAST = { random: 'Data' };
2828
// $DisableFlowOnNegativeTest
2929
expect(() => print(badAST)).to.throw(
30-
'Invalid AST Node: { random: "Data" }',
30+
'Invalid AST Node: { random: "Data" }.',
3131
);
3232
});
3333

src/language/__tests__/schema-printer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Printer: SDL document', () => {
2323
const badAST = { random: 'Data' };
2424
// $DisableFlowOnNegativeTest
2525
expect(() => print(badAST)).to.throw(
26-
'Invalid AST Node: { random: "Data" }',
26+
'Invalid AST Node: { random: "Data" }.',
2727
);
2828
});
2929

src/language/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class Parser {
171171
const sourceObj = typeof source === 'string' ? new Source(source) : source;
172172
devAssert(
173173
sourceObj instanceof Source,
174-
`Must provide Source. Received: ${inspect(sourceObj)}`,
174+
`Must provide Source. Received: ${inspect(sourceObj)}.`,
175175
);
176176

177177
this._lexer = new Lexer(sourceObj);

src/language/source.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ export class Source {
2727
this.locationOffset = locationOffset || { line: 1, column: 1 };
2828
devAssert(
2929
this.locationOffset.line > 0,
30-
'line in locationOffset is 1-indexed and must be positive',
30+
'line in locationOffset is 1-indexed and must be positive.',
3131
);
3232
devAssert(
3333
this.locationOffset.column > 0,
34-
'column in locationOffset is 1-indexed and must be positive',
34+
'column in locationOffset is 1-indexed and must be positive.',
3535
);
3636
}
3737
}

src/language/visitor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function visit(
294294
let result;
295295
if (!Array.isArray(node)) {
296296
if (!isNode(node)) {
297-
throw new Error('Invalid AST Node: ' + inspect(node));
297+
throw new Error(`Invalid AST Node: ${inspect(node)}.`);
298298
}
299299
const visitFn = getVisitFn(visitor, node.kind, isLeaving);
300300
if (visitFn) {

src/subscription/__tests__/subscribe-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,13 @@ describe('Subscription Initialization Phase', () => {
337337
await expectPromiseToThrow(
338338
// $DisableFlowOnNegativeTest
339339
() => subscribe(emailSchema, null),
340-
'Must provide document',
340+
'Must provide document.',
341341
);
342342

343343
await expectPromiseToThrow(
344344
// $DisableFlowOnNegativeTest
345345
() => subscribe({ schema: emailSchema }),
346-
'Must provide document',
346+
'Must provide document.',
347347
);
348348
});
349349

@@ -386,7 +386,7 @@ describe('Subscription Initialization Phase', () => {
386386

387387
await expectPromiseToThrow(
388388
() => createSubscription(pubsub, invalidEmailSchema),
389-
'Subscription field must return Async Iterable. Received: "test"',
389+
'Subscription field must return Async Iterable. Received: "test".',
390390
);
391391
});
392392

0 commit comments

Comments
 (0)