Skip to content

Commit

Permalink
Fixed joining error strings (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinapathak authored Apr 16, 2019
1 parent bfe47e1 commit 642e8fc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bascule/error.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package bascule

import "fmt"
import (
"fmt"
"strings"
)

// Error is an optional interface to be implemented by security related errors
type Error interface {
Expand All @@ -15,11 +18,11 @@ type MultiError interface {
type Errors []error

func (e Errors) Error() string {
var errors string
var errors []string
for _, err := range e {
errors = errors + ", " + err.Error()
errors = append(errors, err.Error())
}
return fmt.Sprintf("multiple errors: [%v]", errors)
return fmt.Sprintf("multiple errors: [%v]", strings.Join(errors, ", "))
}

func (e Errors) Errors() []error {
Expand Down

0 comments on commit 642e8fc

Please sign in to comment.