fix error strings

This commit is contained in:
Sascha L. Teichmann 2024-01-06 10:17:25 +01:00
parent fa0ec06e36
commit 65762936a4
5 changed files with 7 additions and 7 deletions

View File

@ -22,7 +22,7 @@ const (
) )
// ErrDatabaseNotExists indicates that the database does not exist. // ErrDatabaseNotExists indicates that the database does not exist.
var ErrDatabaseNotExists = errors.New("Database does not exists.") var ErrDatabaseNotExists = errors.New("database does not exists")
const blocksPerTx = 128 // Number of blocks copied in a transaction. const blocksPerTx = 128 // Number of blocks copied in a transaction.

View File

@ -105,7 +105,7 @@ func (rp *RedisParser) bulkString(line []byte) bool {
default: default:
if i > rp.maxBulkStringSize { // prevent denial of service. if i > rp.maxBulkStringSize { // prevent denial of service.
return rp.consumeError( return rp.consumeError(
fmt.Errorf("Bulk string too large (%d bytes).\n", i)) fmt.Errorf("bulk string too large (%d bytes)", i))
} }
data := make([]byte, i) data := make([]byte, i)
for rest := i; rest > 0; { for rest := i; rest > 0; {

View File

@ -18,9 +18,9 @@ import (
// Error returned if a Producer has run to its end. // Error returned if a Producer has run to its end.
var ( var (
ErrNoMoreBlocks = errors.New("No more blocks.") ErrNoMoreBlocks = errors.New("no more blocks")
ErrMapContentSizeMismatch = errors.New("Content size does not match.") ErrMapContentSizeMismatch = errors.New("content size does not match")
ErrBlockTruncated = errors.New("Block is truncated.") ErrBlockTruncated = errors.New("block is truncated")
) )
const ( const (

View File

@ -83,7 +83,7 @@ func tmpName(tmpl string) (string, error) {
rrand = reseed() rrand = reseed()
} }
} }
return "", errors.New("Cannot create temp name") return "", errors.New("cannot create temp name")
} }
func SaveAsPNGAtomic(path string, img image.Image) (err error) { func SaveAsPNGAtomic(path string, img image.Image) (err error) {

View File

@ -107,7 +107,7 @@ func isError(line []byte) error {
// parseSize is a cheaper replacement for fmt.Sscanf(string(line), "$%d\r\n", &size). // parseSize is a cheaper replacement for fmt.Sscanf(string(line), "$%d\r\n", &size).
func parseSize(line []byte) (int, error) { func parseSize(line []byte) (int, error) {
if len(line) < 1 || line[0] != '$' { if len(line) < 1 || line[0] != '$' {
return 0, errors.New("Missing '$' at begin of line") return 0, errors.New("missing '$' at begin of line")
} }
line = bytes.TrimFunc(line[1:], unicode.IsSpace) line = bytes.TrimFunc(line[1:], unicode.IsSpace)
v, err := strconv.ParseInt(string(line), 10, 0) v, err := strconv.ParseInt(string(line), 10, 0)