Skip to content

Commit ede8399

Browse files
committed
Implemented a missing formatter method for WrappedInsertError
1 parent eff2c25 commit ede8399

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sql/errors.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package sql
1616

1717
import (
1818
"fmt"
19+
"io"
1920
"strings"
2021

2122
"github.com/dolthub/vitess/go/mysql"
@@ -1068,6 +1069,15 @@ func (w WrappedInsertError) Error() string {
10681069
return w.Cause.Error()
10691070
}
10701071

1072+
// Format implements fmt.Formatter
1073+
func (w WrappedInsertError) Format(s fmt.State, verb rune) {
1074+
if fmtErr, ok := w.Cause.(fmt.Formatter); ok {
1075+
fmtErr.Format(s, verb)
1076+
return
1077+
}
1078+
_, _ = io.WriteString(s, w.Error())
1079+
}
1080+
10711081
// IgnorableError is used propagate information about an error that needs to be ignored and does not interfere with
10721082
// any update accumulators
10731083
type IgnorableError struct {

0 commit comments

Comments
 (0)