Skip to content

Commit

Permalink
🐛 Log first error instead of last during failures
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jun 1, 2022
1 parent 2753640 commit 2491cdc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/visitor/template_comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ func (v *TemplateComments) Visit(n ast.Node) ast.Visitor {
if comment := node.GetCommentTmpl(v.conf.Prefix, n.Value); comment != "" {
newNode, err := templateComment(v.conf, comment, n.Value)
if err != nil {
v.err = err
if v.err == nil {
v.err = err
}
return nil
}

if newNode != nil {
if err := n.Replace(newNode); err != nil {
v.err = err
if v.err == nil {
v.err = err
}
return nil
}
}
Expand All @@ -44,13 +48,17 @@ func (v *TemplateComments) Visit(n ast.Node) ast.Visitor {
if comment := node.GetCommentTmpl(v.conf.Prefix, value); comment != "" {
newNode, err := templateComment(v.conf, comment, value)
if err != nil {
v.err = err
if v.err == nil {
v.err = err
}
return nil
}

if newNode != nil {
if err := n.Replace(i, newNode); err != nil {
v.err = err
if v.err == nil {
v.err = err
}
return nil
}
}
Expand Down

0 comments on commit 2491cdc

Please sign in to comment.