From 6d2de206abdcce9e176bbc157cd27b37a20b0f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Vel=C3=A1squez?= Date: Fri, 12 May 2023 12:21:00 -0500 Subject: [PATCH] [client-preset] Error message enhancement (#9315) * docs: enhance error message * style: format code with Prettier * Create cool-waves-impress.md --------- Co-authored-by: Saihajpreet Singh --- .changeset/cool-waves-impress.md | 5 +++++ packages/presets/client/src/index.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/cool-waves-impress.md diff --git a/.changeset/cool-waves-impress.md b/.changeset/cool-waves-impress.md new file mode 100644 index 00000000000..de178ddba1e --- /dev/null +++ b/.changeset/cool-waves-impress.md @@ -0,0 +1,5 @@ +--- +"@graphql-codegen/client-preset": patch +--- + +improve error message diff --git a/packages/presets/client/src/index.ts b/packages/presets/client/src/index.ts index d9e41185ae9..60a450a8950 100644 --- a/packages/presets/client/src/index.ts +++ b/packages/presets/client/src/index.ts @@ -101,7 +101,9 @@ export const preset: Types.OutputPreset = { prepareDocuments: (outputFilePath, outputSpecificDocuments) => [...outputSpecificDocuments, `!${outputFilePath}`], buildGeneratesSection: options => { if (!isOutputFolderLike(options.baseOutputDir)) { - throw new Error('[client-preset] target output should be a directory, ex: "src/gql/"'); + throw new Error( + '[client-preset] target output should be a directory, ex: "src/gql/". Make sure you add "/" at the end of the directory path' + ); } if (options.plugins.length > 0 && Object.keys(options.plugins).some(p => p.startsWith('typescript'))) {