Skip to content

Commit 596c33f

Browse files
PR 239 update: Adding more logging for the initial generate setup (#246)
This is just a tweak to #239 to update the snapshots. I have: - [X] Written a clear PR title and description (above) - [X] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla) - [X] Added tests covering my changes, if applicable - [X] Included a link to the issue fixed, if applicable - [X] Included documentation, for new features - [ ] Added an entry to the changelog Signed-off-by: Steve Coffman <[email protected]> Co-authored-by: Sam Wallace <[email protected]>
1 parent b1adeca commit 596c33f

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

generate/config.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,16 @@ func (c *Config) ValidateAndFillDefaults(baseDir string) error {
102102
if c.Package == "" {
103103
abs, err := filepath.Abs(c.Generated)
104104
if err != nil {
105-
return errorf(nil, "unable to guess package-name: %v", err)
105+
return errorf(nil, "unable to guess package-name: %v is not a valid identifier"+
106+
"\nSet package name in genqlient.yaml"+
107+
"\nExample: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L6", err)
106108
}
107109

108110
base := filepath.Base(filepath.Dir(abs))
109111
if !token.IsIdentifier(base) {
110-
return errorf(nil, "unable to guess package-name: %v is not a valid identifier", base)
112+
return errorf(nil, "unable to guess package-name: %v is not a valid identifier"+
113+
"\nSet package name in genqlient.yaml"+
114+
"\nExample: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L6", base)
111115
}
112116

113117
c.Package = base

generate/convert.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ func (g *generator) convertDefinition(
524524

525525
// (If you had an entry in bindings, we would have returned it above.)
526526
return nil, errorf(
527-
pos, `unknown scalar %v: please add it to "bindings" in genqlient.yaml`, def.Name)
527+
pos, "unknown scalar %v: please add it to \"bindings\" in genqlient.yaml"+
528+
"\nExample: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L12", def.Name)
528529
default:
529530
return nil, errorf(pos, "unexpected kind: %v", def.Kind)
530531
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
testdata/errors/UnknownScalar.schema.graphql:3: unknown scalar UnknownScalar: please add it to "bindings" in genqlient.yaml
2+
Example: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L12
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
testdata/errors/UnknownScalar.schema.graphql:3: unknown scalar UnknownScalar: please add it to "bindings" in genqlient.yaml
2+
Example: https://github.com/Khan/genqlient/blob/main/example/genqlient.yaml#L12

0 commit comments

Comments
 (0)