Skip to content

Commit b84dda2

Browse files
Add clearer error text a few places (#117)
## Summary: It's nice to be clear here because it may be your first interaction with genqlient! ## Test plan: make check Author: benjaminjkraft Reviewers: StevenACoffman, benjaminjkraft, dnerdy Required Reviewers: Approved By: StevenACoffman Checks: ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint, ✅ Test (1.17), ✅ Test (1.16), ✅ Test (1.15), ✅ Test (1.14), ✅ Lint Pull Request URL: #117
1 parent 65c3e20 commit b84dda2

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

generate/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ func initConfig(filename string) error {
117117
}
118118
w, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644)
119119
if err != nil {
120-
return err
120+
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
121121
}
122122
_, err = io.Copy(w, r)
123-
return err
123+
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
124124
}

generate/generate.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ func Generate(config *Config) (map[string][]byte, error) {
316316
// way. (As-is, we generate a broken file, with just (unused) imports.)
317317
if len(document.Operations) == 0 {
318318
// Hard to have a position when there are no operations :(
319-
return nil, errorf(nil, "no queries found, looked in: %v",
319+
return nil, errorf(nil,
320+
"no queries found, looked in: %v (configure this in genqlient.yaml)",
320321
strings.Join(config.Operations, ", "))
321322
}
322323

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
no queries found, looked in: testdata/errors/NoQuery.go
1+
no queries found, looked in: testdata/errors/NoQuery.go (configure this in genqlient.yaml)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
no queries found, looked in: testdata/errors/NoQuery.graphql
1+
no queries found, looked in: testdata/errors/NoQuery.graphql (configure this in genqlient.yaml)

0 commit comments

Comments
 (0)