Fix error handling during config init (#142)
Previously initConfig always returned an error even if it succeeded. This resulted in a confusing CLI error message that did not match the executed behavior. Now it returns an error only if it fails to init the config.
This commit is contained in:
+4
-1
@@ -121,5 +121,8 @@ func initConfig(filename string) error {
|
||||
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
|
||||
}
|
||||
_, err = io.Copy(w, r)
|
||||
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
|
||||
if err != nil {
|
||||
return errorf(nil, "unable to write default genqlient.yaml: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user