Skip to content

Commit

Permalink
feat(debug): output warnings on stderr; hint how to view full error (#24
Browse files Browse the repository at this point in the history
)
  • Loading branch information
benjie authored Jul 26, 2017
1 parent deee148 commit 77edca3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ export default (function PgQueryProceduresPlugin(builder) {
fieldWithHooks,
});
} catch (e) {
debugWarn(
`Failed to add function '${proc.namespace.name}.${proc.name}':`
// eslint-disable-next-line no-console
console.warn(
`Failed to add function '${proc.namespace
.name}.${proc.name}'; run with 'DEBUG="graphql-build-pg:warn"' to view the error`
);
debugWarn(e);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql-build/src/makeNewBuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type SchemaBuilder, { Build, Scope, DataForType } from "./SchemaBuilder";
const isString = str => typeof str === "string";
const isDev = ["test", "development"].indexOf(process.env.NODE_ENV) >= 0;
const debug = debugFactory("graphql-build");
const debugWarn = debugFactory("graphql-build:warn");

export type FieldWithHooksFunction = (
fieldName: string,
Expand Down Expand Up @@ -532,10 +533,9 @@ export default function makeNewBuild(builder: SchemaBuilder): Build {
// XXX: Improve this
// eslint-disable-next-line no-console
console.warn(
"An error occurred, it might be okay but it doesn't look like the error we were expecting..."
`An error occurred, it might be okay but it doesn't look like the error we were expecting... run with envvar 'DEBUG="graphql-build:warn"' to view the error`
);
// eslint-disable-next-line no-console
console.warn(e);
debugWarn(e);
}
return null;
}
Expand Down

0 comments on commit 77edca3

Please sign in to comment.