Skip to content

Commit

Permalink
Merge pull request #4743 from rhcarvalho/followup-pr4660-new-app-err-msg
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Feb 5, 2016
2 parents f9289e1 + df1f5e9 commit 6e75bd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/generate/app/templatelookup.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"encoding/json"
"fmt"
"strings"

Expand Down Expand Up @@ -117,6 +118,9 @@ func (r *TemplateFileSearcher) Search(precise bool, terms ...string) (ComponentM
case strings.Contains(err.Error(), "does not exist") && strings.Contains(err.Error(), "the path"):
continue
default:
if syntaxErr, ok := err.(*json.SyntaxError); ok {
err = fmt.Errorf("at offset %d: %v", syntaxErr.Offset, err)
}
errs = append(errs, fmt.Errorf("unable to load template file %q: %v", term, err))
continue
}
Expand Down
2 changes: 1 addition & 1 deletion test/cmd/newapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ os::cmd::expect_success 'oc new-app https://github.com/openshift/ruby-hello-worl
os::cmd::expect_success 'oc delete all -l app=ruby'
# check for error when template JSON file has errors
jsonfile="${OS_ROOT}/test/fixtures/invalid.json"
os::cmd::expect_failure_and_text "oc new-app '${jsonfile}'" "error: unable to load template file \"${jsonfile}\": invalid character '}' after object key"
os::cmd::expect_failure_and_text "oc new-app '${jsonfile}'" "error: unable to load template file \"${jsonfile}\": at offset 8: invalid character '}' after object key"

# check new-build
os::cmd::expect_failure_and_text 'oc new-build mysql -o yaml' 'you must specify at least one source repository URL'
Expand Down

0 comments on commit 6e75bd5

Please sign in to comment.