propagate error from closure

This commit is contained in:
Francisco Miamoto 2020-08-12 09:18:43 -03:00
parent bba2d6d204
commit 800be370de

View file

@ -300,8 +300,6 @@ func fillPlaceholders(value string, opts *ApiOptions) (string, error) {
return value, err
}
var branch string
filled := placeholderRE.ReplaceAllStringFunc(value, func(m string) string {
switch m {
case ":owner":
@ -309,7 +307,10 @@ func fillPlaceholders(value string, opts *ApiOptions) (string, error) {
case ":repo":
return baseRepo.RepoName()
case ":branch":
branch, err = opts.Branch()
branch, e := opts.Branch()
if e != nil {
err = e
}
return branch
default:
panic(fmt.Sprintf("invalid placeholder: %q", m))