MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / NewDefaultError

Function NewDefaultError

IceFireDB-SQLProxy/pkg/mysql/mysql/error.go:27–44  ·  view source on GitHub ↗

NewDefaultError: default mysql error, must adapt errname message format

(errCode uint16, args ...any)

Source from the content-addressed store, hash-verified

25
26// NewDefaultError: default mysql error, must adapt errname message format
27func NewDefaultError(errCode uint16, args ...any) *MyError {
28 e := new(MyError)
29 e.Code = errCode
30
31 if s, ok := MySQLState[errCode]; ok {
32 e.State = s
33 } else {
34 e.State = DEFAULT_MYSQL_STATE
35 }
36
37 if format, ok := MySQLErrName[errCode]; ok {
38 e.Message = fmt.Sprintf(format, args...)
39 } else {
40 e.Message = fmt.Sprint(args...)
41 }
42
43 return e
44}
45
46func NewError(errCode uint16, message string) *MyError {
47 e := new(MyError)

Callers 5

handshakeMethod · 0.50
acquirePasswordMethod · 0.50
readAuthDataMethod · 0.50
handleStmtExecuteMethod · 0.50
handleStmtResetMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected