Skip to content

Commit

Permalink
Fix function name
Browse files Browse the repository at this point in the history
  • Loading branch information
kazukousen committed Jan 9, 2024
1 parent 88cf9b3 commit c639cea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions pperr.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ func Fprint(w io.Writer, err error) {
}

func FprintFunc(w io.Writer, err error, puts Printer) {
for _, e := range extractErrorSet(err, nil) {
for _, e := range extractErrorSets(err, nil) {
puts(w, e.Error, e.Frames, e.Parent)
}
}

func ExtractErrorSet(err error) []ErrorSet {
return extractErrorSet(err, nil)
func ExtractErrorSets(err error) ErrorSets {
return extractErrorSets(err, nil)
}

func extractErrorSet(err error, parent Frames) []ErrorSet {
func extractErrorSets(err error, parent Frames) []ErrorSet {
if err == nil {
return nil
}
Expand All @@ -70,7 +70,7 @@ func extractErrorSet(err error, parent Frames) []ErrorSet {
causeParent = parent
}

if es := extractErrorSet(withCause.Unwrap(), causeParent); es != nil {
if es := extractErrorSets(withCause.Unwrap(), causeParent); es != nil {
errs = es
}
}
Expand Down
4 changes: 2 additions & 2 deletions pperr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func f3(native bool) error {
}
}

func TestExtractErrorSet(t *testing.T) {
func TestExtractErrorSets(t *testing.T) {
assert := assert.New(t)

err := f1(true)

var buf strings.Builder
for _, e := range pperr.ExtractErrorSet(err) {
for _, e := range pperr.ExtractErrorSets(err) {
pperr.DefaultPrinter(&buf, e.Error, e.Frames, e.Parent)
}
actual := buf.String()
Expand Down

0 comments on commit c639cea

Please sign in to comment.