Skip to content

Commit 800be37

Browse files
committed
propagate error from closure
1 parent bba2d6d commit 800be37

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/cmd/api/api.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,17 @@ func fillPlaceholders(value string, opts *ApiOptions) (string, error) {
300300
return value, err
301301
}
302302

303-
var branch string
304-
305303
filled := placeholderRE.ReplaceAllStringFunc(value, func(m string) string {
306304
switch m {
307305
case ":owner":
308306
return baseRepo.RepoOwner()
309307
case ":repo":
310308
return baseRepo.RepoName()
311309
case ":branch":
312-
branch, err = opts.Branch()
310+
branch, e := opts.Branch()
311+
if e != nil {
312+
err = e
313+
}
313314
return branch
314315
default:
315316
panic(fmt.Sprintf("invalid placeholder: %q", m))

0 commit comments

Comments
 (0)