errors

package
v0.0.56 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package errors provides error types and function

Package errors provides benchmark error

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides benchmark error

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Copyright (C) 2019-2020 Vdaas.org Vald team ( kpango, rinx, kmrmt )

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Package errors provides error types and function

Index

Constants

This section is empty.

Variables

View Source
var (
	// BlobStorage
	NewErrBlobNoSuchBucket = func(err error, name string) error {
		return &ErrBlobNoSuchBucket{
			err: Wrap(err, Errorf("bucket %s not found", name).Error()),
		}
	}

	NewErrBlobNoSuchKey = func(err error, key string) error {
		return &ErrBlobNoSuchKey{
			err: Wrap(err, Errorf("key %s not found", key).Error()),
		}
	}
)
View Source
var (

	// Cassandra
	ErrCassandraInvalidConsistencyType = func(consistency string) error {
		return Errorf("consistetncy type %q is not defined", consistency)
	}

	NewErrCassandraNotFoundIdentity = func() error {
		return &ErrCassandraNotFoundIdentity{
			err: New("cassandra entry not found"),
		}
	}

	NewErrCassandraUnavailableIdentity = func() error {
		return &ErrCassandraUnavailableIdentity{
			err: New("cassandra unavailable"),
		}
	}

	ErrCassandraUnavailable = NewErrCassandraUnavailableIdentity

	ErrCassandraNotFound = func(keys ...string) error {
		switch {
		case len(keys) == 1:
			return Wrapf(NewErrCassandraNotFoundIdentity(), "cassandra key '%s' not found", keys[0])
		case len(keys) > 1:
			return Wrapf(NewErrCassandraNotFoundIdentity(), "cassandra keys '%v' not found", keys)
		default:
			return nil
		}
	}

	ErrCassandraGetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "error failed to fetch key (%s)", key)
	}

	ErrCassandraSetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "error failed to set key (%s)", key)
	}

	ErrCassandraDeleteOperationFailed = func(key string, err error) error {
		return Wrapf(err, "error failed to delete key (%s)", key)
	}

	ErrCassandraHostDownDetected = func(err error, nodeInfo string) error {
		return Wrapf(err, "error cassandra host down detected\t%s", nodeInfo)
	}
)
View Source
var (
	// internal compressor
	ErrInvalidCompressionLevel = func(level int) error {
		return Errorf("invalid compression level: %d", level)
	}

	// Compressor
	ErrCompressorNameNotFound = func(name string) error {
		return Errorf("compressor %s not found", name)
	}

	ErrCompressedDataNotFound = New("compressed data not found")

	ErrDecompressedDataNotFound = New("decompressed data not found")

	ErrCompressFailed = New("compress failed")

	ErrDecompressFailed = New("decompress failed")

	ErrCompressorRegistererIsNotRunning = func() error {
		return Errorf("compressor registerers is not running")
	}

	ErrCompressorRegistererChannelIsFull = func() error {
		return Errorf("compressor registerer channel is full")
	}
)
View Source
var (
	ErrAddrCouldNotDiscover = func(err error, record string) error {
		return Wrapf(err, "addr %s ip couldn't discover", record)
	}

	ErrNodeNotFound = func(node string) error {
		return Errorf("discover node %s not found", node)
	}

	ErrNamespaceNotFound = func(ns string) error {
		return Errorf("discover namespace %s not found", ns)
	}

	ErrPodNameNotFound = func(name string) error {
		return Errorf("discover pod %s not found", name)
	}

	ErrInvalidDiscoveryCache = New("cache type cast failed")
)
View Source
var (
	ErrTimeoutParseFailed = func(timeout string) error {
		return Errorf("invalid timeout value: %s\t:timeout parse error out put failed", timeout)
	}

	ErrServerNotFound = func(name string) error {
		return Errorf("server %s not found", name)
	}

	ErrOptionFailed = func(err error, ref reflect.Value) error {
		return Wrapf(err, "failed to setup option :\t%s",
			runtime.FuncForPC(ref.Pointer()).Name())
	}

	ErrArgumentParseFailed = func(err error) error {
		return Wrap(err, "argument parse failed")
	}

	ErrBackoffTimeout = func(err error) error {
		return Wrap(err, "backoff timeout by limitation")
	}

	ErrInvalidTypeConversion = func(i interface{}, tgt interface{}) error {
		return Errorf("invalid type conversion %v to %v", reflect.TypeOf(i), reflect.TypeOf(tgt))
	}

	ErrLoggingRetry = func(err error, ref reflect.Value) error {
		return Wrapf(err, "failed to output %s logs, retrying...",
			runtime.FuncForPC(ref.Pointer()).Name())
	}

	ErrLoggingFailed = func(err error, ref reflect.Value) error {
		return Wrapf(err, "failed to output %s logs",
			runtime.FuncForPC(ref.Pointer()).Name())
	}

	New = func(msg string) error {
		if msg == "" {
			return nil
		}
		return errors.New(msg)
	}

	Wrap = func(err error, msg string) error {
		if err != nil {
			if msg != "" {
				return fmt.Errorf("%s: %w", msg, err)
			}
			return err
		}
		return New(msg)
	}

	Wrapf = func(err error, format string, args ...interface{}) error {
		if err != nil {
			if format != "" && len(args) > 0 {
				return Wrap(err, fmt.Sprintf(format, args...))
			}
			return err
		}
		return Errorf(format, args...)
	}

	Cause = func(err error) error {
		if err != nil {
			return errors.Unwrap(err)
		}
		return nil
	}

	Unwrap = errors.Unwrap

	Errorf = func(format string, args ...interface{}) error {
		if format != "" && args != nil && len(args) > 0 {
			return fmt.Errorf(format, args...)
		}
		return nil
	}

	Is = func(err, target error) bool {
		if target == nil {
			return err == target
		}

		isComparable := reflect.TypeOf(target).Comparable()
		for {
			if isComparable && (err == target || err.Error() == target.Error()) {
				return true
			}
			if x, ok := err.(interface {
				Is(error) bool
			}); ok && x.Is(target) {
				return true
			}
			if uerr := Unwrap(err); uerr == nil {
				return err.Error() == target.Error()
			} else {
				err = uerr
			}
		}
	}

	As = errors.As
)
View Source
var (
	ErrWatchDirNotFound = New("fs watcher watch dir not found")

	ErrFileAlreadyExists = func(path string) error {
		return Errorf("file already exists: %s", path)
	}

	ErrPathNotSpecified = New("the path is not specified")
)
View Source
var (
	ErrgRPCClientConnectionClose = func(name string, err error) error {
		return Wrapf(err, "%s's gRPC connection close error", name)
	}

	ErrInvalidGRPCPort = func(addr, host string, port uint16) error {
		return Errorf("invalid gRPC client connection port to addr: %s,\thost: %s\t port: %d", addr, host, port)
	}

	ErrInvalidGRPCClientConn = func(addr string) error {
		return Errorf("invalid gRPC client connection to %s", addr)
	}

	ErrGRPCLookupIPAddrNotFound = func(host string) error {
		return Errorf("vald internal gRPC client could not find ip addrs for %s", host)
	}

	ErrGRPCClientNotFound = New("vald internal gRPC client not found")

	ErrGRPCClientConnNotFound = func(addr string) error {
		return Errorf("gRPC client connection not found in %s", addr)
	}

	ErrRPCCallFailed = func(addr string, err error) error {
		return Wrapf(err, "addr: %s", addr)
	}

	ErrGRPCTargetAddrNotFound = New("grpc connection target not found")
)
View Source
var (
	ErrInvalidAPIConfig = New("invalid api config")

	ErrInvalidRequest = New("invalid request")

	ErrHandler = func(err error) error {
		return Wrap(err, "handler returned error")
	}

	ErrHandlerTimeout = func(err error, dur time.Duration) error {
		return Wrapf(err, "handler timeout %s", dur.String())
	}

	ErrRequestBodyCloseAndFlush = func(err error) error {
		return Wrap(err, "request body flush & close failed")
	}

	ErrRequestBodyClose = func(err error) error {
		return Wrap(err, "request body close failed")
	}

	ErrRequestBodyFlush = func(err error) error {
		return Wrap(err, "request body flush failed")
	}

	ErrTransportRetryable = New("transport is retryable")
)
View Source
var (
	// io
	NewErrContextNotProvided = func() error {
		return New("context not provided")
	}

	NewErrReaderNotProvided = func() error {
		return New("io.Reader not provided")
	}

	NewErrWriterNotProvided = func() error {
		return New("io.Writer not provided")
	}
)
View Source
var (
	// MySQL
	ErrMySQLConnectionPingFailed = New("error MySQL connection ping failed")

	NewErrMySQLNotFoundIdentity = func() error {
		return &ErrMySQLNotFoundIdentity{
			err: New("error mysql element not found"),
		}
	}

	ErrMySQLConnectionClosed = New("error MySQL connection closed")

	ErrRequiredElementNotFoundByUUID = func(uuid string) error {
		return Wrapf(NewErrMySQLNotFoundIdentity(), "error required element not found, uuid: %s", uuid)
	}

	NewErrMySQLInvalidArgumentIdentity = func() error {
		return &ErrMySQLInvalidArgumentIdentity{
			err: New("error mysql invalid argument"),
		}
	}

	ErrRequiredMemberNotFilled = func(member string) error {
		return Wrapf(NewErrMySQLInvalidArgumentIdentity(), "error required member not filled (member: %s)", member)
	}
)
View Source
var (

	// ErrFailedInitDialer defines the init dialer error
	ErrFailedInitDialer = New("failed to init dialer")
	// ErrInvalidDNSConfig defines the invalid DNS config error
	ErrInvalidDNSConfig = func(dnsRefreshDur, dnsCacheExp time.Duration) error {
		return Errorf("dnsRefreshDuration  > dnsCacheExp, %s, %s", dnsRefreshDur, dnsCacheExp)
	}

	// ErrNoPortAvailiable defines no port available error
	ErrNoPortAvailable = New("no port available")
)
View Source
var (
	ErrCreateProperty = func(err error) error {
		return Wrap(err, "failed to create property")
	}

	ErrIndexNotFound = New("index file not found")

	ErrIndexLoadTimeout = New("index load timeout")

	ErrInvalidDimensionSize = func(current, limit int) error {
		if limit == 0 {
			return Errorf("dimension size %d is invalid, the supporting dimension size must be bigger than 2", current)
		}
		return Errorf("dimension size %d is invalid, the supporting dimension size must be between 2 ~ %d", current, limit)
	}

	ErrDimensionLimitExceed = func(current, limit int) error {
		return Errorf("supported dimension limit exceed:\trequired = %d,\tlimit = %d", current, limit)
	}

	ErrUnsupportedObjectType = New("unsupported ObjectType")

	ErrUnsupportedDistanceType = New("unsupported DistanceType")

	ErrFailedToSetDistanceType = func(err error, distance string) error {
		return Wrap(err, "failed to set distance type "+distance)
	}

	ErrFailedToSetObjectType = func(err error, t string) error {
		return Wrap(err, "failed to set object type "+t)
	}

	ErrFailedToSetDimension = func(err error) error {
		return Wrap(err, "failed to set dimension")
	}

	ErrFailedToSetCreationEdgeSize = func(err error) error {
		return Wrap(err, "failed to set creation edge size")
	}

	ErrFailedToSetSearchEdgeSize = func(err error) error {
		return Wrap(err, "failed to set search edge size")
	}

	ErrUncommittedIndexExists = func(num uint64) error {
		return Errorf("%d indexes are not committed", num)
	}

	ErrUncommittedIndexNotFound = New("uncommitted indexes are not found")

	// ErrCAPINotImplemented raises using not implemented function in C API
	ErrCAPINotImplemented = New("not implemented in C API")

	ErrUUIDAlreadyExists = func(uuid string, oid uint) error {
		return Errorf("ngt uuid %s object id %d already exists ", uuid, oid)
	}

	ErrUUIDNotFound = func(id uint32) error {
		if id == 0 {
			return Errorf("ngt object uuid not found", id)
		}
		return Errorf("ngt object uuid %d's metadata not found", id)
	}

	ErrObjectIDNotFound = func(uuid string) error {
		return Errorf("ngt uuid %s's object id not found", uuid)
	}

	ErrObjectNotFound = func(err error, uuid string) error {
		return Wrapf(err, "ngt uuid %s's object not found", uuid)
	}

	ErrRemoveRequestedBeforeIndexing = func(oid uint) error {
		return Errorf("object id %d is not indexed we cannot remove it", oid)
	}
)
View Source
var (

	// Redis
	ErrRedisInvalidKVVKPrefix = func(kv, vk string) error {
		return Errorf("kv index and vk prefix must be defferent.\t(kv: %s,\tvk: %s)", kv, vk)
	}

	NewErrRedisNotFoundIdentity = func() error {
		return &ErrRedisNotFoundIdentity{
			err: New("error redis entry not found"),
		}
	}

	ErrRedisNotFound = func(key string) error {
		return Wrapf(NewErrRedisNotFoundIdentity(), "error redis key '%s' not found", key)
	}

	ErrRedisGetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "Failed to fetch key (%s)", key)
	}

	ErrRedisSetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "Failed to set key (%s)", key)
	}

	ErrRedisDeleteOperationFailed = func(key string, err error) error {
		return Wrapf(err, "Failed to delete key (%s)", key)
	}

	ErrInvalidConfigVersion = func(cur, con string) error {
		return Errorf("invalid config version %s not satisfies version constraints %s", cur, con)
	}

	ErrRedisAddrsNotFound = New("addrs not found")

	ErrRedisConnectionPingFailed = New("error Redis connection ping failed")
)
View Source
var (
	ErrDaemonStartFailed = func(err error) error {
		return Wrap(err, "failed to start daemon")
	}

	ErrDaemonStopFailed = func(err error) error {
		return Wrap(err, "failed to stop daemon")
	}

	ErrStartFunc = func(name string, err error) error {
		return Wrapf(err, "error occured in runner.Start at %s", name)
	}

	ErrPreStopFunc = func(name string, err error) error {
		return Wrapf(err, "error occured in runner.PreStop at %s", name)
	}

	ErrStopFunc = func(name string, err error) error {
		return Wrapf(err, "error occured in runner.Stop at %s", name)
	}

	ErrPostStopFunc = func(name string, err error) error {
		return Wrapf(err, "error occured in runner.PostStop at %s", name)
	}

	ErrRunnerWait = func(name string, err error) error {
		return Wrapf(err, "error occured in runner.Wait at %s", name)
	}
)
View Source
var (
	ErrPanicRecovered = func(err error, rec interface{}) error {
		return Wrap(err, Errorf("panic recovered: %v", rec).Error())
	}

	ErrPanicString = func(err error, msg string) error {
		return Wrap(err, Errorf("panic recovered: %v", msg).Error())
	}

	ErrRuntimeError = func(err error, r runtime.Error) error {
		return Wrap(err, Errorf("system paniced caused by runtime error: %v", r).Error())
	}
)
View Source
var (
	ErrInvalidStorageType = New("invalid storage type")

	ErrStorageReaderNotOpened = New("reader not opened")
	ErrStorageWriterNotOpened = New("writer not opened")
)
View Source
var (
	ErrFailedToCastTF = func(v interface{}) error {
		return Errorf("failed to cast tensorflow result %+v", v)
	}
	ErrInputLength = func(i int, f int) error {
		return Errorf("inputs length %d does not match feeds length %d", i, f)
	}
	ErrNilTensorTF = func(v interface{}) error {
		return Errorf("nil tensorflow tensor %+v", v)
	}
	ErrNilTensorValueTF = func(v interface{}) error {
		return Errorf("nil tensorflow tensor value %+v", v)
	}
)
View Source
var (

	// ErrTLSDisabled is error variable, it's replesents config error that tls is disabled by config
	ErrTLSDisabled = New("tls feature is disabled")

	// ErrTLSCertOrKeyNotFound is error variable, it's replesents tls cert or key not found error
	ErrTLSCertOrKeyNotFound = New("cert or key file path not found")

	ErrCertificationFailed = New("certification failed")
)
View Source
var (
	ErrMetaDataAlreadyExists = func(meta string) error {
		return Errorf("vald metadata:\t%s\talready exists ", meta)
	}

	ErrMetaDataCannotFetch = func() error {
		return Errorf("vald metadata cannot fetch")
	}
)
View Source
var (
	ErrWorkerIsNotRunning = func(name string) error {
		return Errorf("worker %s is not running", name)
	}

	ErrWorkerIsAlreadyRunning = func(name string) error {
		return Errorf("worker %s is already running", name)
	}

	ErrQueueIsNotRunning = func() error {
		return New("queue is not running")
	}

	ErrQueueIsAlreadyRunning = func() error {
		return New("queue is already running")
	}

	ErrJobFuncIsNil = func() error {
		return New("JobFunc is nil")
	}
)
View Source
var (
	ErrCollectorNotFound = func() error {
		return New("observability.collector not found")
	}
)
View Source
var (
	ErrGoNGTNotSupportedMethod = New("not supported method")
)
View Source
var (
	ErrInvalidBackupConfig = New("invalid backup config")
)
View Source
var (
	ErrInvalidCacherType = New("invalid cacher type")
)
View Source
var (
	ErrInvalidCoreMode = New("invalid core mode")
)
View Source
var (
	ErrInvalidMetaDataConfig = New("invalid metadata config")
)
View Source
var (
	ErrInvalidReconcilerConfig = New("invalid reconciler config")
)
View Source
var (
	ErrParseUnitFailed = func(s string) error {
		return Errorf("failed to parse: '%s'", s)
	}
)
View Source
var (
	// ErrUnsupportedClientMethod is unsupported method error for gRPC/REST client
	ErrUnsupportedClientMethod = New("unsupported method")
)

Functions

func IsErrBlobNoSuchBucket added in v0.0.41

func IsErrBlobNoSuchBucket(err error) bool

func IsErrBlobNoSuchKey added in v0.0.41

func IsErrBlobNoSuchKey(err error) bool

func IsErrCassandraNotFound

func IsErrCassandraNotFound(err error) bool

func IsErrCassandraUnavailable added in v0.0.25

func IsErrCassandraUnavailable(err error) bool

func IsErrMySQLInvalidArgument

func IsErrMySQLInvalidArgument(err error) bool

func IsErrMySQLNotFound

func IsErrMySQLNotFound(err error) bool

func IsErrRedisNotFound

func IsErrRedisNotFound(err error) bool

func NewErrCriticalOption added in v0.0.56

func NewErrCriticalOption(name string, val interface{}, errs ...error) error

func NewErrInvalidOption added in v0.0.56

func NewErrInvalidOption(name string, val interface{}, errs ...error) error

Types

type ErrBlobNoSuchBucket added in v0.0.41

type ErrBlobNoSuchBucket struct {
	// contains filtered or unexported fields
}

func (*ErrBlobNoSuchBucket) Error added in v0.0.41

func (e *ErrBlobNoSuchBucket) Error() string

func (*ErrBlobNoSuchBucket) Unwrap added in v0.0.53

func (e *ErrBlobNoSuchBucket) Unwrap() error

type ErrBlobNoSuchKey added in v0.0.41

type ErrBlobNoSuchKey struct {
	// contains filtered or unexported fields
}

func (*ErrBlobNoSuchKey) Error added in v0.0.41

func (e *ErrBlobNoSuchKey) Error() string

func (*ErrBlobNoSuchKey) Unwrap added in v0.0.53

func (e *ErrBlobNoSuchKey) Unwrap() error

type ErrCassandraNotFoundIdentity

type ErrCassandraNotFoundIdentity struct {
	// contains filtered or unexported fields
}

func (*ErrCassandraNotFoundIdentity) Error

func (*ErrCassandraNotFoundIdentity) Unwrap added in v0.0.53

func (e *ErrCassandraNotFoundIdentity) Unwrap() error

type ErrCassandraUnavailableIdentity added in v0.0.25

type ErrCassandraUnavailableIdentity struct {
	// contains filtered or unexported fields
}

func (*ErrCassandraUnavailableIdentity) Error added in v0.0.25

func (*ErrCassandraUnavailableIdentity) Unwrap added in v0.0.53

type ErrCriticalOption added in v0.0.56

type ErrCriticalOption struct {
	// contains filtered or unexported fields
}

ErrCriticalOption represent the critical option error

func (*ErrCriticalOption) Error added in v0.0.56

func (e *ErrCriticalOption) Error() string

func (*ErrCriticalOption) Unwrap added in v0.0.56

func (e *ErrCriticalOption) Unwrap() error

type ErrInvalidOption added in v0.0.53

type ErrInvalidOption struct {
	// contains filtered or unexported fields
}

ErrInvalidOption represent the invalid option error

func (*ErrInvalidOption) Error added in v0.0.56

func (e *ErrInvalidOption) Error() string

func (*ErrInvalidOption) Unwrap added in v0.0.56

func (e *ErrInvalidOption) Unwrap() error

type ErrMySQLInvalidArgumentIdentity

type ErrMySQLInvalidArgumentIdentity struct {
	// contains filtered or unexported fields
}

func (*ErrMySQLInvalidArgumentIdentity) Error

func (*ErrMySQLInvalidArgumentIdentity) Unwrap added in v0.0.53

type ErrMySQLNotFoundIdentity

type ErrMySQLNotFoundIdentity struct {
	// contains filtered or unexported fields
}

func (*ErrMySQLNotFoundIdentity) Error

func (e *ErrMySQLNotFoundIdentity) Error() string

func (*ErrMySQLNotFoundIdentity) Unwrap added in v0.0.53

func (e *ErrMySQLNotFoundIdentity) Unwrap() error

type ErrRedisNotFoundIdentity

type ErrRedisNotFoundIdentity struct {
	// contains filtered or unexported fields
}

func (*ErrRedisNotFoundIdentity) Error

func (e *ErrRedisNotFoundIdentity) Error() string

func (*ErrRedisNotFoundIdentity) Unwrap added in v0.0.53

func (e *ErrRedisNotFoundIdentity) Unwrap() error

Jump to

Keyboard shortcuts

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