Skip to content

Commit

Permalink
adjust newapp/newbuild error messages (arg classification vs. actual …
Browse files Browse the repository at this point in the history
…processing
  • Loading branch information
gabemontero committed Jan 24, 2018
1 parent cf406ea commit 8f7f63f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/generate/app/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ type ErrNoMatch struct {

func (e ErrNoMatch) Error() string {
if len(e.Qualifier) != 0 {
return fmt.Sprintf("no match for %q: %s", e.Value, e.Qualifier)
return fmt.Sprintf("unable to locate resource for %q: %s", e.Value, e.Qualifier)
}
return fmt.Sprintf("no match for %q", e.Value)
return fmt.Sprintf("unable to locate resource for %q", e.Value)
}

// Suggestion is the usage error message returned when no match is found.
Expand Down
2 changes: 1 addition & 1 deletion pkg/oc/cli/cmd/newapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ func handleError(err error, baseName, commandName, commandPath string, config *n
// this print serves as a header for the printing of the errorGroups, but
// only print it if we precede with classification errors, to help distinguish
// between the two
fmt.Fprintln(buf, "Errors occurred during resource creation:")
fmt.Fprintln(buf, "Errors occurred during %s processing of arguments:")
}
for _, group := range groups {
fmt.Fprint(buf, kcmdutil.MultipleErrors("error: ", group.errs))
Expand Down
8 changes: 8 additions & 0 deletions pkg/oc/generate/app/cmd/newapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,17 @@ func (c *AppConfig) AddArguments(args []string) []string {

switch {
case c.tryToAddEnvironmentArguments(s):
// does not update c.ArgumentClassificationErrors
case c.tryToAddSourceArguments(s):
// successful with first classification attempt
case c.tryToAddComponentArguments(s):
// clear out any errors noted for source classification as we are successful with component
// classification
c.ArgumentClassificationErrors = []ArgumentClassificationError{}
case c.tryToAddTemplateArguments(s):
// clear out any errors noted for source/component classification as we are successful with template
// classification
c.ArgumentClassificationErrors = []ArgumentClassificationError{}
default:
glog.V(2).Infof("treating %s as unknown\n", s)
unknown = append(unknown, s)
Expand Down

0 comments on commit 8f7f63f

Please sign in to comment.