Skip to content

Commit 9e4cd89

Browse files
dkhalizovCopilot
authored andcommitted
Update pkg/notifications/templates.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a3a0c83 commit 9e4cd89

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/notifications/templates.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ func makeTmplOrDefault(tp EventType, tmpl string) *template.Template {
5555

5656
t, err := template.New(string(tp)).Parse(tmpl)
5757
if err != nil {
58-
log.Printf("failed to parse %s template: %v", tp, err)
59-
60-
return nil
58+
log.Printf("failed to parse %s template: %v, falling back to default template", tp, err)
59+
t, err = template.New(string(tp)).Parse(defaultTemplatesMapping[tp])
60+
if err != nil {
61+
log.Printf("failed to parse default template for %s: %v", tp, err)
62+
return nil
63+
}
6164
}
6265

6366
return t

0 commit comments

Comments
 (0)