Skip to content

Commit

Permalink
Be nice(r) when no arguments given
Browse files Browse the repository at this point in the history
Having a standalone install `persistgraphql` gives

> Usage: persistgraphql input_file [output_file]
(node:46389) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined
    at Object.fs.stat (fs.js:884:3)
    at /usr/local/lib/node_modules/persistgraphql/lib/src/ExtractGQL.js:45:16
    at new Promise (<anonymous>)
    at Function.ExtractGQL.isDirectory (/usr/local/lib/node_modules/persistgraphql/lib/src/ExtractGQL.js:44:16)
    at /usr/local/lib/node_modules/persistgraphql/lib/src/ExtractGQL.js:139:24
    at new Promise (<anonymous>)
    at ExtractGQL.readInputPath (/usr/local/lib/node_modules/persistgraphql/lib/src/ExtractGQL.js:138:16)
    at /usr/local/lib/node_modules/persistgraphql/lib/src/ExtractGQL.js:129:19
    at new Promise (<anonymous>)
    at ExtractGQL.processInputPath (/usr/local/lib/node_modules/persistgraphql/lib/src/ExtractGQL.js:128:16)
  • Loading branch information
clemens-tolboom authored May 27, 2018
1 parent 8420e55 commit 94b7ab6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/ExtractGQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ export const main = (argv: YArgsv) => {

if (args.length < 1) {
console.log('Usage: persistgraphql input_file [output_file]');
process.exit(1);
} else if (args.length === 1) {
inputFilePath = args[0];
} else {
Expand Down

0 comments on commit 94b7ab6

Please sign in to comment.