Skip to content

Commit

Permalink
[client-preset] Error message enhancement (#9315)
Browse files Browse the repository at this point in the history
* docs: enhance error message

* style: format code with Prettier

* Create cool-waves-impress.md

---------

Co-authored-by: Saihajpreet Singh <saihajpreet.singh@gmail.com>
  • Loading branch information
larxn and saihaj authored May 12, 2023
1 parent bfc7a0d commit 6d2de20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cool-waves-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphql-codegen/client-preset": patch
---

improve error message
4 changes: 3 additions & 1 deletion packages/presets/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ export const preset: Types.OutputPreset<ClientPresetConfig> = {
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'))) {
Expand Down

0 comments on commit 6d2de20

Please sign in to comment.