Skip to content

Commit 8f7f63f

Browse files
committed
adjust newapp/newbuild error messages (arg classification vs. actual processing
1 parent cf406ea commit 8f7f63f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

pkg/generate/app/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ type ErrNoMatch struct {
1717

1818
func (e ErrNoMatch) Error() string {
1919
if len(e.Qualifier) != 0 {
20-
return fmt.Sprintf("no match for %q: %s", e.Value, e.Qualifier)
20+
return fmt.Sprintf("unable to locate resource for %q: %s", e.Value, e.Qualifier)
2121
}
22-
return fmt.Sprintf("no match for %q", e.Value)
22+
return fmt.Sprintf("unable to locate resource for %q", e.Value)
2323
}
2424

2525
// Suggestion is the usage error message returned when no match is found.

pkg/oc/cli/cmd/newapp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ func handleError(err error, baseName, commandName, commandPath string, config *n
723723
// this print serves as a header for the printing of the errorGroups, but
724724
// only print it if we precede with classification errors, to help distinguish
725725
// between the two
726-
fmt.Fprintln(buf, "Errors occurred during resource creation:")
726+
fmt.Fprintln(buf, "Errors occurred during %s processing of arguments:")
727727
}
728728
for _, group := range groups {
729729
fmt.Fprint(buf, kcmdutil.MultipleErrors("error: ", group.errs))

pkg/oc/generate/app/cmd/newapp.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,17 @@ func (c *AppConfig) AddArguments(args []string) []string {
320320

321321
switch {
322322
case c.tryToAddEnvironmentArguments(s):
323+
// does not update c.ArgumentClassificationErrors
323324
case c.tryToAddSourceArguments(s):
325+
// successful with first classification attempt
324326
case c.tryToAddComponentArguments(s):
327+
// clear out any errors noted for source classification as we are successful with component
328+
// classification
329+
c.ArgumentClassificationErrors = []ArgumentClassificationError{}
325330
case c.tryToAddTemplateArguments(s):
331+
// clear out any errors noted for source/component classification as we are successful with template
332+
// classification
333+
c.ArgumentClassificationErrors = []ArgumentClassificationError{}
326334
default:
327335
glog.V(2).Infof("treating %s as unknown\n", s)
328336
unknown = append(unknown, s)

0 commit comments

Comments
 (0)