Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent graphql error #258

Merged
merged 2 commits into from
Jan 28, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions command/pr_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ func prCreate(cmd *cobra.Command, _ []string) error {
}

if action == SubmitAction {
if title == "" {
return fmt.Errorf("Can't create a PR without a title.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. In general, we try to not use capitalization or punctuation in error messages (in fact, go-lint warns about this) to make wrapping of errors easier
  2. Let's use "pull request" instead of PR in user-facing messages
  3. (nitpick) I generally try to avoid contractions in text UIs, perhaps you'd be open to rewording "can't" as "could not" or something similar? Another way to put this could be "pull request title must not be blank"

}

params := map[string]interface{}{
"title": title,
"body": body,
Expand Down