mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
33 lines
433 B
Go
33 lines
433 B
Go
|
|
package sqlite3
|
||
|
|
|
||
|
|
import (
|
||
|
|
"strconv"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
type Error struct {
|
||
|
|
Code int
|
||
|
|
ExtendedCode int
|
||
|
|
str string
|
||
|
|
msg string
|
||
|
|
}
|
||
|
|
|
||
|
|
func (e Error) Error() string {
|
||
|
|
var b strings.Builder
|
||
|
|
b.WriteString("sqlite3: ")
|
||
|
|
|
||
|
|
if e.str != "" {
|
||
|
|
b.WriteString(e.str)
|
||
|
|
} else {
|
||
|
|
b.WriteString(strconv.Itoa(e.Code))
|
||
|
|
}
|
||
|
|
|
||
|
|
if e.msg != "" {
|
||
|
|
b.WriteByte(':')
|
||
|
|
b.WriteByte(' ')
|
||
|
|
b.WriteString(e.msg)
|
||
|
|
}
|
||
|
|
|
||
|
|
return b.String()
|
||
|
|
}
|