errors

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDSNUnescaped       = errors.New("invalid DSN: did you forget to escape a param value?")
	ErrInvalidDSNAddr            = errors.New("invalid DSN: network address not terminated (missing closing brace)")
	ErrInvalidDSNNoSlash         = errors.New("invalid DSN: missing the slash separating the database name")
	ErrInvalidDSNUnsafeCollation = errors.New("invalid DSN: interpolateParams can not be used with unsafe collations")

	ErrInvalidConn       = errors.New("invalid connection")
	ErrMalformedPkt      = errors.New("malformed packet")
	ErrNoTLS             = errors.New("TLS requested but server does not support TLS")
	ErrCleartextPassword = errors.New("this user requires clear text authentication. If you still want to use it, please add 'allowCleartextPasswords=1' to your DSN")
	ErrNativePassword    = errors.New("this user requires mysql native password authentication.")
	ErrOldPassword       = errors.New("this user requires old password authentication. If you still want to use it, please add 'allowOldPasswords=1' to your DSN. See also https://github.com/go-sql-driver/mysql/wiki/old_passwords")
	ErrUnknownPlugin     = errors.New("this authentication plugin is not supported")
	ErrOldProtocol       = errors.New("MySQL server does not support required protocol 41+")
	ErrPktSync           = errors.New("commands out of sync. You can't run this command now")
	ErrPktSyncMul        = errors.New("commands out of sync. Did you run multiple statements at once?")
	ErrPktTooLarge       = errors.New("packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server")
	ErrBusyBuffer        = errors.New("busy buffer")

	// ErrBadConnNoWrite is used for connection errors where nothing was sent to the database yet.
	// If this happens first in a function starting a database interaction, it should be replaced by driver.ErrBadConn
	// to trigger a resend.
	// See https://github.com/go-sql-driver/mysql/pull/302
	ErrBadConnNoWrite = errors.New("bad connection")

	ErrTransactionClosed = errors.New("transaction closed")
	ErrUnexpectedRead    = errors.New("unexpected read from socket")
)
View Source
var (
	GlobalTransactionNotActive     = errors.New("global session not active")
	GlobalTransactionFinished      = errors.New("global session finished")
	CouldNotFoundGlobalTransaction = errors.New("could not found global transaction")
	CouldNotFoundBranchTransaction = errors.New("could not found branch transaction")
	BranchLockAcquireFailed        = errors.New("branch lock acquire failed")
)
View Source
var CannotEvalWithColumnName = errors.New("cannot eval function with column name")

Functions

func IsConnErr

func IsConnErr(err error) bool

IsConnErr returns true if the error is a connection error.

func IsEvalWithColumnErr

func IsEvalWithColumnErr(err error) bool

Types

type SQLError

type SQLError struct {
	Num     int
	State   string
	Message string
	Query   string
}

SQLError is the error structure returned from calling a db library function

func NewSQLError

func NewSQLError(number int, sqlState string, format string, args ...interface{}) *SQLError

NewSQLError creates a new SQLError. If sqlState is left empty, it will default to "HY000" (general error). TODO: Should be aligned with vterrors, stack traces and wrapping

func (*SQLError) Error

func (se *SQLError) Error() string

Error implements the error interface

func (*SQLError) Number

func (se *SQLError) Number() int

Number returns the internal MySQL error code.

func (*SQLError) SQLState

func (se *SQLError) SQLState() string

SQLState returns the SQLSTATE value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL