Skip to content

Commit

Permalink
Merge 27039f0 into 39af41c
Browse files Browse the repository at this point in the history
  • Loading branch information
estk committed Sep 22, 2016
2 parents 39af41c + 27039f0 commit 38f0ffb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

### VNEXT
* Log errors on plugin construction and use.

### v0.3.2
* Added missing exports for hapi integration ([@nnance](https://github.com/nnance)) in [PR #152](https://github.com/apollostack/apollo-server/pull/152)
Expand Down
3 changes: 3 additions & 0 deletions src/integrations/expressApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function apolloExpress(options: ApolloOptions | ExpressApolloOptionsFunct
try {
optionsObject = await options(req, res);
} catch (e) {
console.error(e.stack)
res.statusCode = 500;
res.write(`Invalid options provided to ApolloServer: ${e.message}`);
res.end();
Expand Down Expand Up @@ -80,6 +81,7 @@ export function apolloExpress(options: ApolloOptions | ExpressApolloOptionsFunct
try {
variables = JSON.parse(variables);
} catch (error) {
console.error(error.stack)
res.statusCode = 400;
res.write('Variables are invalid JSON.');
res.end();
Expand Down Expand Up @@ -107,6 +109,7 @@ export function apolloExpress(options: ApolloOptions | ExpressApolloOptionsFunct

responses.push(await runQuery(params));
} catch (e) {
console.error(e.stack)
responses.push({ errors: [formatErrorFn(e)] });
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/integrations/hapiApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function getGraphQLParams(payload, isBatch, reply) {
try {
variables = JSON.parse(variables);
} catch (error) {
console.error(error.stack)
return reply(createErr(400, 'Variables are invalid JSON.'));
}
}
Expand All @@ -116,6 +117,7 @@ async function getApolloOptions(request: Request, reply: IReply): Promise<{}> {
const opsFunc: HapiOptionsFunction = <HapiOptionsFunction>options;
optionsObject = await opsFunc(request);
} catch (e) {
console.error(e.stack)
return reply(createErr(500, `Invalid options provided to ApolloServer: ${e.message}`));
}
} else {
Expand Down Expand Up @@ -150,6 +152,7 @@ async function processQuery(graphqlParams, optionsObject: ApolloOptions, reply)

responses.push(await runQuery(params));
} catch (e) {
console.error(e.stack)
responses.push({ errors: [formatErrorFn(e)] });
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/integrations/koaApollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function apolloKoa(options: ApolloOptions | KoaApolloOptionsFunction): Ko
try {
optionsObject = await options(ctx.request);
} catch (e) {
console.error(e.stack);
ctx.status = 500;
return ctx.body = `Invalid options provided to ApolloServer: ${e.message}`;
}
Expand Down Expand Up @@ -59,6 +60,7 @@ export function apolloKoa(options: ApolloOptions | KoaApolloOptionsFunction): Ko
try {
variables = JSON.parse(variables);
} catch (error) {
console.error(error.stack);
ctx.status = 400;
return ctx.body = 'Variables are invalid JSON.';
}
Expand All @@ -84,6 +86,7 @@ export function apolloKoa(options: ApolloOptions | KoaApolloOptionsFunction): Ko

responses.push(await runQuery(params));
} catch (e) {
console.error(e.stack);
responses.push({ errors: [formatErrorFn(e)] });
}
}
Expand Down

0 comments on commit 38f0ffb

Please sign in to comment.