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: https://github.com/Khan/genqlient/pull/117
This commit is contained in:
+2
-2
@@ -117,8 +117,8 @@ func initConfig(filename string) error {
|
|||||||
}
|
}
|
||||||
w, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644)
|
w, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
|
||||||
}
|
}
|
||||||
_, err = io.Copy(w, r)
|
_, err = io.Copy(w, r)
|
||||||
return err
|
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,7 +316,8 @@ func Generate(config *Config) (map[string][]byte, error) {
|
|||||||
// way. (As-is, we generate a broken file, with just (unused) imports.)
|
// way. (As-is, we generate a broken file, with just (unused) imports.)
|
||||||
if len(document.Operations) == 0 {
|
if len(document.Operations) == 0 {
|
||||||
// Hard to have a position when there are no operations :(
|
// Hard to have a position when there are no operations :(
|
||||||
return nil, errorf(nil, "no queries found, looked in: %v",
|
return nil, errorf(nil,
|
||||||
|
"no queries found, looked in: %v (configure this in genqlient.yaml)",
|
||||||
strings.Join(config.Operations, ", "))
|
strings.Join(config.Operations, ", "))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
no queries found, looked in: testdata/errors/NoQuery.go
|
no queries found, looked in: testdata/errors/NoQuery.go (configure this in genqlient.yaml)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
no queries found, looked in: testdata/errors/NoQuery.graphql
|
no queries found, looked in: testdata/errors/NoQuery.graphql (configure this in genqlient.yaml)
|
||||||
|
|||||||
Reference in New Issue
Block a user