Skip to content

Commit

Permalink
fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfish-shogi committed Dec 2, 2020
1 parent 4c77d39 commit c4b2fed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions string.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ func (m *stringifier) stringifyArray(t reflect.Type, v reflect.Value, config fie
m2.buf.WriteString(sep)
}

var err error
err = m2.stringify(t.Elem(), v.Index(i), config, depth+1)
if err != nil {
if err := m2.stringify(t.Elem(), v.Index(i), config, depth+1); err != nil {
return err
}
}
Expand Down Expand Up @@ -197,7 +195,9 @@ func (m *stringifier) stringifySlice(t reflect.Type, v reflect.Value, config fie
m2.buf.WriteString(sep)
}

m2.stringify(t.Elem(), v.Index(i), config, depth+1)
if err := m2.stringify(t.Elem(), v.Index(i), config, depth+1); err != nil {
return err
}
}
if config.str {
m.buf.WriteString(util.EscapeUnprintables(m2.buf.String()))
Expand Down

0 comments on commit c4b2fed

Please sign in to comment.