errors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 5 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")

	ErrInvalidConn       = errors.New("invalid connection")
	ErrMalformPkt        = 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")
)

Functions

func IsConnErr

func IsConnErr(err error) bool

IsConnErr returns true if the error is a connection error.

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