errors

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 6 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 error types and function

Package errors provides benchmark error

Package errors provides error types and function

Package errors provides error types and function

Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.org>

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

Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.org>

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

Package errors provides error types and function

Index

Constants

This section is empty.

Variables

View Source
var (
	// NewErrBlobNoSuchBucket represents a function to create no such bucket error.
	NewErrBlobNoSuchBucket = func(err error, name string) error {
		return &ErrBlobNoSuchBucket{
			err: Wrap(err, Errorf("bucket %s not found", name).Error()),
		}
	}

	// NewErrBlobNoSuchKey represents a function to create no such key error.
	NewErrBlobNoSuchKey = func(err error, key string) error {
		return &ErrBlobNoSuchKey{
			err: Wrap(err, Errorf("key %s not found", key).Error()),
		}
	}
)
View Source
var (
	// ErrCassandraInvalidConsistencyType represents a function to generate an error of consistency type not defined.
	ErrCassandraInvalidConsistencyType = func(consistency string) error {
		return Errorf("consistetncy type %q is not defined", consistency)
	}

	// NewErrCassandraNotFoundIdentity represents a function to generate an error of cassandra entry not found.
	NewErrCassandraNotFoundIdentity = func() error {
		return &ErrCassandraNotFoundIdentity{
			err: New("cassandra entry not found"),
		}
	}

	// NewErrCassandraUnavailableIdentity represents a function to generate an error of cassandra unavailable.
	NewErrCassandraUnavailableIdentity = func() error {
		return &ErrCassandraUnavailableIdentity{
			err: New("cassandra unavailable"),
		}
	}

	// ErrCassandraUnavailable represents NewErrCassandraUnavailableIdentity.
	ErrCassandraUnavailable = NewErrCassandraUnavailableIdentity

	// ErrCassandraNotFound represents a function to generate an error of cassandra keys not found.
	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 represents a function to generate an error of fetch key failed.
	ErrCassandraGetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "error failed to fetch key (%s)", key)
	}

	// ErrCassandraSetOperationFailed represents a function to generate an error of set key failed.
	ErrCassandraSetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "error failed to set key (%s)", key)
	}

	// ErrCassandraDeleteOperationFailed represents a function to generate an error of delete key failed.
	ErrCassandraDeleteOperationFailed = func(key string, err error) error {
		return Wrapf(err, "error failed to delete key (%s)", key)
	}

	// ErrCassandraHostDownDetected represents a function to generate an error of cassandra host down detected.
	ErrCassandraHostDownDetected = func(err error, nodeInfo string) error {
		return Wrapf(err, "error cassandra host down detected\t%s", nodeInfo)
	}
	ErrCassandraFailedToCreateSession = func(err error, hosts []string, port int, cqlVersion string) error {
		return Wrapf(err, "error cassandra client failed to create session to hosts: %v\tport: %d\tcql_version: %s ", hosts, port, cqlVersion)
	}
)
View Source
var (
	// ErrInvalidCompressionLevel represents a function to generate an error of invalid compression level.
	ErrInvalidCompressionLevel = func(level int) error {
		return Errorf("invalid compression level: %d", level)
	}

	// ErrCompressorNameNotFound represents a function to generate an error of compressor not found.
	ErrCompressorNameNotFound = func(name string) error {
		return Errorf("compressor %s not found", name)
	}

	// ErrCompressedDataNotFound returns an error of compressed data is not found.
	ErrCompressedDataNotFound = New("compressed data not found")

	// ErrDecompressedDataNotFound returns an error of decompressed data is not found.
	ErrDecompressedDataNotFound = New("decompressed data not found")

	// ErrCompressFailed returns an error of compress failed.
	ErrCompressFailed = New("compress failed")

	// ErrDecompressFailed returns an error of decompressing failed.
	ErrDecompressFailed = New("decompress failed")

	// ErrCompressorRegistererIsNotRunning represents a function to generate an error of compressor registerers is not running.
	ErrCompressorRegistererIsNotRunning = func() error {
		return New("compressor registerers is not running")
	}

	// ErrCompressorRegistererChannelIsFull represents a function to generate an error that compressor registerer channel is full.
	ErrCompressorRegistererChannelIsFull = func() error {
		return New("compressor registerer channel is full")
	}
)
View Source
var (
	// ErrAddrCouldNotDiscover represents a function to generate an error that address couldn't discover.
	ErrAddrCouldNotDiscover = func(err error, record string) error {
		return Wrapf(err, "addr %s ip couldn't discover", record)
	}

	// ErrNodeNotFound represents a function to generate an error of discover node not found.
	ErrNodeNotFound = func(node string) error {
		return Errorf("discover node %s not found", node)
	}

	// ErrNamespaceNotFound represents a function to generate an error of discover namespace not found.
	ErrNamespaceNotFound = func(ns string) error {
		return Errorf("discover namespace %s not found", ns)
	}

	// ErrPodNameNotFound represents a function to generate an error of discover pod not found.
	ErrPodNameNotFound = func(name string) error {
		return Errorf("discover pod %s not found", name)
	}

	// ErrInvalidDiscoveryCache represents an error that type conversion of discovery cache failed.
	ErrInvalidDiscoveryCache = New("cache type cast failed")
)
View Source
var (
	// ErrTimeoutParseFailed represents a function to generate an error that the timeout value is invalid.
	ErrTimeoutParseFailed = func(timeout string) error {
		return Errorf("invalid timeout value: %s\t:timeout parse error out put failed", timeout)
	}

	// ErrServerNotFound represents a function to generate an error that the server not found.
	ErrServerNotFound = func(name string) error {
		return Errorf("server %s not found", name)
	}

	// ErrOptionFailed represents a function to generate an error that the option setup failed.
	// When ref is zero value, it will return an error with ref is invalid.
	ErrOptionFailed = func(err error, ref reflect.Value) error {
		var str string
		if ref.IsValid() {
			str = runtime.FuncForPC(ref.Pointer()).Name()
		}
		return Wrapf(err, "failed to setup option :\t%s", str)
	}

	// ErrArgumentParseFailed represents a function to generate an error that argument parse failed.
	ErrArgumentParseFailed = func(err error) error {
		return Wrap(err, "argument parse failed")
	}

	// ErrBackoffTimeout represents a function to generate an error that backoff is timeout by limitation.
	ErrBackoffTimeout = func(err error) error {
		return Wrap(err, "backoff timeout by limitation")
	}

	// ErrInvalidTypeConversion represents a function to generate an error that type conversion fails due to an invalid input type.
	ErrInvalidTypeConversion = func(i interface{}, tgt interface{}) error {
		return Errorf("invalid type conversion %v to %v", reflect.TypeOf(i), reflect.TypeOf(tgt))
	}

	// ErrLoggingRetry represents a function to generate an error that failing to output logs and retrying to output.
	ErrLoggingRetry = func(err error, ref reflect.Value) error {
		var str string
		if ref.IsValid() {
			str = runtime.FuncForPC(ref.Pointer()).Name()
		}
		return Wrapf(err, "failed to output %s logs, retrying...", str)
	}

	// ErrLoggingFailed represents a function to generate an error that failing to output logs.
	ErrLoggingFailed = func(err error, ref reflect.Value) error {
		var str string
		if ref.IsValid() {
			str = runtime.FuncForPC(ref.Pointer()).Name()
		}
		return Wrapf(err, "failed to output %s logs", str)
	}

	// New represents a function to generate the new error with a message.
	// When the message is nil, it will return nil instead of an error.
	New = func(msg string) error {
		if msg == "" {
			return nil
		}
		return errors.New(msg)
	}

	// Wrap represents a function to generate an error that is used by input error and message.
	// When both of the input are nil, it will return an error when the error message is not empty.
	// When the input error is not nil, it will return the error based on the input error.
	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 represents a function to generate an error that is used by input error, format, and args.
	// When all of the input is nil, it will return a new error based on format and args even these are nil.
	// When the input error is not nil, it will return an error based on the input error.
	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 represents a function to generate an error when the input error is not nil.
	// When the input is nil, it will return nil.
	Cause = func(err error) error {
		if err != nil {
			return errors.Unwrap(err)
		}
		return nil
	}

	// Unwrap represents errors.Unwrap.
	Unwrap = errors.Unwrap

	// Errorf represents a function to generate an error based on format and args.
	// When format and args do not satisfy the condition, it will return nil.
	Errorf = func(format string, args ...interface{}) error {
		const delim = " "
		if format == "" && len(args) == 0 {
			return nil
		}
		if len(args) != 0 {
			if format == "" {
				for range args {
					format += "%v" + delim
				}
				format = strings.TrimSuffix(format, delim)
			}
			return fmt.Errorf(format, args...)
		}
		return New(format)
	}

	// Is represents a function to check whether err and the target is the same or not.
	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() ||
				strings.EqualFold(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 == target ||
					err.Error() == target.Error() ||
					strings.EqualFold(err.Error(), target.Error()))
			} else {
				err = uerr
			}
		}
	}

	// As represents errors.As.
	As = errors.As
)
View Source
var (
	// ErrWatchDirNotFound represents an error that the watch directory is not found.
	ErrWatchDirNotFound = New("fs watcher watch dir not found")

	// ErrFileAlreadyExists represents a function to generate an error that the file already exists.
	ErrFileAlreadyExists = func(path string) error {
		return Errorf("file already exists: %s", path)
	}

	// ErrPathNotSpecified represents an error that the path is not specified.
	ErrPathNotSpecified = New("the path is not specified")

	// ErrPathNotAllowed represents a function to generate an error indicates that the specified path is not allowed.
	ErrPathNotAllowed = func(path string) error {
		return Errorf("the specified file path is not allowed: %s", path)
	}
)
View Source
var (
	ErrFilterNotFound       = New("filter not found")
	ErrTargetNotFound       = New("target not found")
	ErrTargetFilterNotFound = func(addr string) error {
		return Errorf("target filter not found addr: %s", addr)
	}
)
View Source
var (

	// ErrGRPCClientConnectionClose represents a function to generate an error that the gRPC connection couldn't close.
	ErrGRPCClientConnectionClose = func(name string, err error) error {
		return Wrapf(err, "%s's gRPC connection close error", name)
	}

	// ErrInvalidGRPCPort represents a function to generate an error that the gRPC port is invalid.
	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 represents a function to generate an error that the vald internal gRPC connection is invalid.
	ErrInvalidGRPCClientConn = func(addr string) error {
		return Errorf("invalid gRPC client connection to %s", addr)
	}

	// ErrGRPCLookupIPAddrNotFound represents a function to generate an error that the vald internal gRPC client couldn't find IP address.
	ErrGRPCLookupIPAddrNotFound = func(host string) error {
		return Errorf("vald internal gRPC client could not find ip addrs for %s", host)
	}

	// ErrGRPCClientNotFound represents an error that the vald internal gRPC client couldn't find.
	ErrGRPCClientNotFound = New("vald internal gRPC client not found")

	// ErrGRPCClientConnNotFound represents a function to generate an error that the gRPC client connection couldn't find.
	ErrGRPCClientConnNotFound = func(addr string) error {
		return Errorf("gRPC client connection not found in %s", addr)
	}

	// ErrGRPCClientStreamNotFound represents an error that the vald internal gRPC client couldn't find any grpc client stream connection.
	ErrGRPCClientStreamNotFound = New("vald internal gRPC client grpc client stream not found")

	// ErrRPCCallFailed represents a function to generate an error that the RPC call failed.
	ErrRPCCallFailed = func(addr string, err error) error {
		return Wrapf(err, "addr: %s", addr)
	}

	// ErrGRPCTargetAddrNotFound represents an error that the gRPC target address couldn't find.
	ErrGRPCTargetAddrNotFound = New("grpc connection target not found")
)
View Source
var (
	// ErrInvalidAPIConfig represents an error that the API configuration is invalid.
	ErrInvalidAPIConfig = New("invalid api config")

	// ErrInvalidRequest represents an error that the API request is invalid.
	ErrInvalidRequest = New("invalid request")

	// ErrHandler represents a function to generate an error that the handler returned an error.
	ErrHandler = func(err error) error {
		return Wrap(err, "handler returned error")
	}

	// ErrHandlerTimeout represents a function to generate an error that the handler was time out.
	ErrHandlerTimeout = func(err error, dur time.Duration) error {
		return Wrapf(err, "handler timeout %s", dur.String())
	}

	// ErrRequestBodyCloseAndFlush represents a function to generate an error that the flush of the request body and the close failed.
	ErrRequestBodyCloseAndFlush = func(err error) error {
		return Wrap(err, "request body flush & close failed")
	}

	// ErrRequestBodyClose represents a function to generate an error that the close of the request body failed.
	ErrRequestBodyClose = func(err error) error {
		return Wrap(err, "request body close failed")
	}

	// ErrRequestBodyFlush represents a function to generate an error that the flush of the request body failed.
	ErrRequestBodyFlush = func(err error) error {
		return Wrap(err, "request body flush failed")
	}

	// ErrTransportRetryable represents an error that the transport is retryable.
	ErrTransportRetryable = New("transport is retryable")
)
View Source
var (
	// ErrFailedToInitInfo represents an error to initialize info.
	ErrFailedToInitInfo = func(err error) error {
		return Wrap(err, "failed to init info")
	}

	// ErrRuntimeFuncNil represents an error that the runtime function is nil.
	ErrRuntimeFuncNil = func() error {
		return New("runtime function is nil")
	}
)
View Source
var (
	// NewErrContextNotProvided represents a function to generate an error that the context is not provided.
	NewErrContextNotProvided = func() error {
		return New("context not provided")
	}

	// NewErrReaderNotProvided represents a function to generate an error that the io.Reader is not provided.
	NewErrReaderNotProvided = func() error {
		return New("io.Reader not provided")
	}

	// NewErrWriterNotProvided represents a function to generate an error that the io.Writer is not provided.
	NewErrWriterNotProvided = func() error {
		return New("io.Writer not provided")
	}
)
View Source
var (
	ErrInvalidMetaDataConfig = New("invalid metadata config")
	ErrMetadataFileEmpty     = New("metadata file empty")
)
View Source
var (
	// ErrMySQLConnectionPingFailed represents an error that the ping failed.
	ErrMySQLConnectionPingFailed = New("error MySQL connection ping failed")

	// NewErrMySQLNotFoundIdentity represents a function to generate an error that the element is not found.
	NewErrMySQLNotFoundIdentity = func() error {
		return &ErrMySQLNotFoundIdentity{
			err: New("error mysql element not found"),
		}
	}

	// ErrMySQLConnectionClosed represents a function to generate an error that the connection closed.
	ErrMySQLConnectionClosed = New("error MySQL connection closed")

	// ErrMySQLTransactionNotCreated represents an error that the transaction is not closed.
	ErrMySQLTransactionNotCreated = New("error MySQL transaction not created")

	// ErrRequiredElementNotFoundByUUID represents a function to generate an error that the required element is not found.
	ErrRequiredElementNotFoundByUUID = func(uuid string) error {
		return Wrapf(NewErrMySQLNotFoundIdentity(), "error required element not found, uuid: %s", uuid)
	}

	// NewErrMySQLInvalidArgumentIdentity represents a function to generate an error that the argument is invalid.
	NewErrMySQLInvalidArgumentIdentity = func() error {
		return &ErrMySQLInvalidArgumentIdentity{
			err: New("error mysql invalid argument"),
		}
	}

	// ErrRequiredMemberNotFilled represents a function to generate an error that the required member is not filled.
	ErrRequiredMemberNotFilled = func(member string) error {
		return Wrapf(NewErrMySQLInvalidArgumentIdentity(), "error required member not filled (member: %s)", member)
	}

	// ErrMySQLSessionNil represents a function to generate an error that the MySQL session is nil.
	ErrMySQLSessionNil = New("error MySQL session is nil")
)
View Source
var (

	// ErrFailedInitDialer represents an error that the initialization of the dialer failed.
	ErrFailedInitDialer = New("failed to init dialer")

	// ErrInvalidDNSConfig represents a function to generate an error that the configuration of the DNS is invalid.
	ErrInvalidDNSConfig = func(dnsRefreshDur, dnsCacheExp time.Duration) error {
		return Errorf("dnsRefreshDuration  > dnsCacheExp, %s, %s", dnsRefreshDur, dnsCacheExp)
	}

	// ErrNoPortAvailable represents a function to generate an error that the port of the host is unavailable.
	ErrNoPortAvailable = func(host string, start, end uint16) error {
		return Errorf("no port available for Host: %s\tbetween %d ~ %d", host, start, end)
	}

	// ErrLookupIPAddrNotFound represents a function to generate an error that the host's ip address could not discovererd from DNS.
	ErrLookupIPAddrNotFound = func(host string) error {
		return Errorf("failed to lookup ip addrs for host: %s", host)
	}
)
View Source
var (
	// ErrCreateProperty represents a function to generate an error that the property creation failed.
	ErrCreateProperty = func(err error) error {
		return Wrap(err, "failed to create property")
	}

	// ErrIndexNotFound represents an error that the index file is not found.
	ErrIndexNotFound = New("index file not found")

	// ErrIndexLoadTimeout represents an error that the index loading timeout.
	ErrIndexLoadTimeout = New("index load timeout")

	// ErrInvalidDimensionSize represents a function to generate an error that the dimension size is invalid.
	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 represents a function to generate an error that the supported dimension limit exceeded.
	ErrDimensionLimitExceed = func(current, limit int) error {
		return Errorf("supported dimension limit exceed:\trequired = %d,\tlimit = %d", current, limit)
	}

	// ErrIncompatibleDimensionSize represents a function to generate an error that the incompatible dimension size detected.
	ErrIncompatibleDimensionSize = func(req, dim int) error {
		return Errorf("incompatible dimension size detected\trequested: %d,\tconfigured: %d", req, dim)
	}

	// ErrUnsupportedObjectType represents an error that the object type is unsupported.
	ErrUnsupportedObjectType = New("unsupported ObjectType")

	// ErrUnsupportedDistanceType represents an error that the distance type is unsupported.
	ErrUnsupportedDistanceType = New("unsupported DistanceType")

	// ErrFailedToSetDistanceType represents a function to generate an error that the set of distance type failed.
	ErrFailedToSetDistanceType = func(err error, distance string) error {
		return Wrap(err, "failed to set distance type "+distance)
	}

	// ErrFailedToSetObjectType represents a function to generate an error that the set of object type failed.
	ErrFailedToSetObjectType = func(err error, t string) error {
		return Wrap(err, "failed to set object type "+t)
	}

	// ErrFailedToSetDimension represents a function to generate an error that the set of dimension failed.
	ErrFailedToSetDimension = func(err error) error {
		return Wrap(err, "failed to set dimension")
	}

	// ErrFailedToSetCreationEdgeSize represents a function to generate an error that the set of creation edge size failed.
	ErrFailedToSetCreationEdgeSize = func(err error) error {
		return Wrap(err, "failed to set creation edge size")
	}

	// ErrFailedToSetSearchEdgeSize represents a function to generate an error that the set of search edge size failed.
	ErrFailedToSetSearchEdgeSize = func(err error) error {
		return Wrap(err, "failed to set search edge size")
	}

	// ErrUncommittedIndexExists represents a function to generate an error that the uncommitted indexes exist.
	ErrUncommittedIndexExists = func(num uint64) error {
		return Errorf("%d indexes are not committed", num)
	}

	// ErrUncommittedIndexNotFound represents an error that the uncommitted indexes are not found.
	ErrUncommittedIndexNotFound = New("uncommitted indexes are not found")

	// ErrCAPINotImplemented represents an error that the function is not implemented in C API.
	ErrCAPINotImplemented = New("not implemented in C API")

	// ErrUUIDAlreadyExists represents a function to generate an error that the uuid already exists.
	ErrUUIDAlreadyExists = func(uuid string) error {
		return Errorf("ngt uuid %s index already exists", uuid)
	}

	// ErrUUIDNotFound represents a function to generate an error that the uuid is not found.
	ErrUUIDNotFound = func(id uint32) error {
		if id == 0 {
			return New("ngt object uuid not found")
		}
		return Errorf("ngt object uuid %d's metadata not found", id)
	}

	// ErrObjectIDNotFound represents a function to generate an error that the object id is not found.
	ErrObjectIDNotFound = func(uuid string) error {
		return Errorf("ngt uuid %s's object id not found", uuid)
	}

	// ErrObjectNotFound represents a function to generate an error that the object is not found.
	ErrObjectNotFound = func(err error, uuid string) error {
		return Wrapf(err, "ngt uuid %s's object not found", uuid)
	}

	// ErrRemoveRequestedBeforeIndexing represents a function to generate an error that the object is not indexed so can not remove it.
	ErrRemoveRequestedBeforeIndexing = func(oid uint) error {
		return Errorf("object id %d is not indexed we cannot remove it", oid)
	}
)
View Source
var (

	// ErrRedisInvalidKVVKPrefix represents a function to generate an error that kv index and vk prefix are invalid.
	ErrRedisInvalidKVVKPrefix = func(kv, vk string) error {
		return Errorf("kv index and vk prefix must be defferent.\t(kv: %s,\tvk: %s)", kv, vk)
	}

	// NewErrRedisNotFoundIdentity represents a function to generate an ErrRedisNotFoundIdentity error.
	NewErrRedisNotFoundIdentity = func() error {
		return &ErrRedisNotFoundIdentity{
			err: New("error redis entry not found"),
		}
	}

	// ErrRedisNotFound represents a function to wrap Redis key not found error and err.
	ErrRedisNotFound = func(key string) error {
		return Wrapf(NewErrRedisNotFoundIdentity(), "error redis key '%s' not found", key)
	}

	// ErrRedisInvalidOption generates a new error of Redis invalid option.
	ErrRedisInvalidOption = New("error redis invalid option")

	// ErrRedisGetOperationFailed represents a function to wrap failed to fetch key error and err.
	ErrRedisGetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "Failed to fetch key (%s)", key)
	}

	// ErrRedisSetOperationFailed represents a function to wrap failed to set key error and err.
	ErrRedisSetOperationFailed = func(key string, err error) error {
		return Wrapf(err, "Failed to set key (%s)", key)
	}

	// ErrRedisSetOperationFailed represents a function to wrap failed to delete key error and err.
	ErrRedisDeleteOperationFailed = func(key string, err error) error {
		return Wrapf(err, "Failed to delete key (%s)", key)
	}

	// ErrRedisSetOperationFailed represents a function to generate an error that invalid configuration version.
	ErrInvalidConfigVersion = func(cur, con string) error {
		return Errorf("invalid config version %s not satisfies version constraints %s", cur, con)
	}

	// ErrRedisAddrsNotFound generates a new error of address not found.
	ErrRedisAddrsNotFound = New("error redis addrs not found")

	// ErrRedisConnectionPingFailed generates a new error of Redis connection ping failed.
	ErrRedisConnectionPingFailed = New("error redis connection ping failed")
)
View Source
var (
	// ErrDaemonStartFailed represents a function to generate an error that failed to start daemon.
	ErrDaemonStartFailed = func(err error) error {
		return Wrap(err, "failed to start daemon")
	}

	// ErrDaemonStopFailed represents a function to generate an error that failed to stop daemon.
	ErrDaemonStopFailed = func(err error) error {
		return Wrap(err, "failed to stop daemon")
	}

	// ErrStartFunc represents a function to generate an error that occurred in the start function.
	ErrStartFunc = func(name string, err error) error {
		return Wrapf(err, "error occurred in runner.Start at %s", name)
	}

	// ErrPreStopFunc represents a function to generate an error that occurred in the pre-stop function.
	ErrPreStopFunc = func(name string, err error) error {
		return Wrapf(err, "error occurred in runner.PreStop at %s", name)
	}

	// ErrStopFunc represents a function to generate an error that occurred in the stop function.
	ErrStopFunc = func(name string, err error) error {
		return Wrapf(err, "error occurred in runner.Stop at %s", name)
	}

	// ErrPostStopFunc represents a function to generate an error that occurred in the post-stop function.
	ErrPostStopFunc = func(name string, err error) error {
		return Wrapf(err, "error occurred in runner.PostStop at %s", name)
	}

	// ErrRunnerWait represents a function to generate an error during runner.Wait.
	ErrRunnerWait = func(name string, err error) error {
		return Wrapf(err, "error occurred in runner.Wait at %s", name)
	}
)
View Source
var (
	// ErrPanicRecovered represents a function to generate an error that the panic recovered.
	ErrPanicRecovered = func(err error, rec interface{}) error {
		return Wrap(err, Errorf("panic recovered: %v", rec).Error())
	}

	// ErrPanicString represents a function to generate an error that the panic recovered with a string message.
	ErrPanicString = func(err error, msg string) error {
		return Wrap(err, Errorf("panic recovered: %v", msg).Error())
	}

	// ErrRuntimeError represents a function to generate an error that the panic caused by runtime error.
	ErrRuntimeError = func(err error, r runtime.Error) error {
		return Wrap(err, Errorf("system panicked 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 represents a function to generate an error that failed to something cast to tensorflow.
	ErrFailedToCastTF = func(v interface{}) error {
		return Errorf("failed to cast tensorflow result %+v", v)
	}

	// ErrInputLength represents a function to generate an error that input length is not equal to required.
	ErrInputLength = func(i int, f int) error {
		return Errorf("inputs length %d does not match feeds length %d", i, f)
	}

	// ErrNilTensorTF represents a function to generate an error that nil tensorflow tensor.
	ErrNilTensorTF = func(v interface{}) error {
		return Errorf("nil tensorflow tensor %+v", v)
	}

	// ErrNilTensorValueTF represents a function to generate an error that nil tensorflow value,
	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 represents a function to generate an error that vald metadata is already exists.
	ErrMetaDataAlreadyExists = func(meta string) error {
		return Errorf("vald metadata:\t%s\talready exists ", meta)
	}

	// ErrMetaDataCannotFetch represents a function to generate an error that vald metadata cannot fetch.
	ErrMetaDataCannotFetch = func() error {
		return Errorf("vald metadata cannot fetch")
	}
)
View Source
var (

	// ErrWorkerIsNotRunning represents a function to generate worker is not running error.
	ErrWorkerIsNotRunning = func(name string) error {
		return Errorf("worker %s is not running", name)
	}

	// ErrWorkerIsAlreadyRunning represents a function to generate worker is already running error.
	ErrWorkerIsAlreadyRunning = func(name string) error {
		return Errorf("worker %s is already running", name)
	}

	// ErrQueueIsNotRunning represents a function to generate the queue is not running error.
	ErrQueueIsNotRunning = func() error {
		return New("queue is not running")
	}

	// ErrQueueIsAlreadyRunning represents a function to generate the queue is already running error.
	ErrQueueIsAlreadyRunning = func() error {
		return New("queue is already running")
	}

	// ErrJobFuncIsNil represents a function to generate job function is nil error.
	ErrJobFuncIsNil = func() error {
		return New("JobFunc is nil")
	}
)
View Source
var (
	ErrCollectorNotFound = func() error {
		return New("observability.collector not found")
	}
)

ErrCollectorNotFound represents a function to generate an error that the observability collector is 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 ErrInvalidReconcilerConfig = New("invalid reconciler config")
View Source
var ErrParseUnitFailed = func(s string) error {
	return Errorf("failed to parse: '%s'", s)
}

ErrParseUnitFailed represents a function to generate an error that failed to parse unit.

View Source
var ErrUnsupportedClientMethod = New("unsupported method")

ErrUnsupportedClientMethod is unsupported method error for gRPC/REST client.

View Source
var ErrVQueueFinalizing = New("error vector queue is now finalizing...")

Functions

func IsErrBlobNoSuchBucket added in v0.0.41

func IsErrBlobNoSuchBucket(err error) bool

IsErrBlobNoSuchBucket returns if the error is ErrBlobNoSuchBucket.

func IsErrBlobNoSuchKey added in v0.0.41

func IsErrBlobNoSuchKey(err error) bool

IsErrBlobNoSuchKey returns if the error is ErrBlobNoSuchKey.

func IsErrCassandraNotFound

func IsErrCassandraNotFound(err error) bool

IsErrCassandraNotFound reports whether any error in err's chain matches ErrCassandraNotFound.

func IsErrCassandraUnavailable added in v0.0.25

func IsErrCassandraUnavailable(err error) bool

IsErrCassandraUnavailable reports whether any error in err's chain matches ErrCassandraUnavailableIdentity.

func IsErrMySQLInvalidArgument

func IsErrMySQLInvalidArgument(err error) bool

IsErrMySQLInvalidArgument returns true when the err type is ErrMySQLInvalidArgumentIdentity.

func IsErrMySQLNotFound

func IsErrMySQLNotFound(err error) bool

IsErrMySQLNotFound returns true when the err type is ErrMySQLNotFoundIdentity.

func IsErrRedisNotFound

func IsErrRedisNotFound(err error) bool

IsErrRedisNotFound compares the input error and ErrRedisNotFoundIdentity.error and returns true or false that is the result of errors.As.

func NewErrCriticalOption added in v0.0.56

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

NewErrCriticalOption represents a function to generate a new error of ErrCriticalOption that invalid option.

func NewErrInvalidOption added in v0.0.56

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

NewErrInvalidOption represents a function to generate a new error of ErrInvalidOption that invalid option.

Types

type ErrBlobNoSuchBucket added in v0.0.41

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

ErrBlobNoSuchBucket represents no such bucket error of S3.

func (*ErrBlobNoSuchBucket) Error added in v0.0.41

func (e *ErrBlobNoSuchBucket) Error() string

Error returns the string representation of the internal error.

func (*ErrBlobNoSuchBucket) Unwrap added in v0.0.53

func (e *ErrBlobNoSuchBucket) Unwrap() error

Unwrap unwraps and returns the internal error.

type ErrBlobNoSuchKey added in v0.0.41

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

ErrBlobNoSuchKey represents no such key error of S3.

func (*ErrBlobNoSuchKey) Error added in v0.0.41

func (e *ErrBlobNoSuchKey) Error() string

Error returns the string representation of the internal error.

func (*ErrBlobNoSuchKey) Unwrap added in v0.0.53

func (e *ErrBlobNoSuchKey) Unwrap() error

Unwrap unwraps and returns the internal error.

type ErrCassandraNotFoundIdentity

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

ErrCassandraNotFoundIdentity represents custom error for cassandra not found.

func (*ErrCassandraNotFoundIdentity) Error

Error returns string of internal error.

func (*ErrCassandraNotFoundIdentity) Unwrap added in v0.0.53

func (e *ErrCassandraNotFoundIdentity) Unwrap() error

Unwrap returns an internal error.

type ErrCassandraUnavailableIdentity added in v0.0.25

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

ErrCassandraUnavailableIdentity represents custom error for cassandra unavailable.

func (*ErrCassandraUnavailableIdentity) Error added in v0.0.25

Error returns string of internal error.

func (*ErrCassandraUnavailableIdentity) Unwrap added in v0.0.53

Unwrap returns internal error.

type ErrCriticalOption added in v0.0.56

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

ErrCriticalOption represents the critical option error.

func (*ErrCriticalOption) Error added in v0.0.56

func (e *ErrCriticalOption) Error() string

Error returns a string of ErrCriticalOption.err.

func (*ErrCriticalOption) Unwrap added in v0.0.56

func (e *ErrCriticalOption) Unwrap() error

Unwrap returns an origin error of ErrCriticalOption.

type ErrInvalidOption added in v0.0.53

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

ErrInvalidOption represents the invalid option error.

func (*ErrInvalidOption) Error added in v0.0.56

func (e *ErrInvalidOption) Error() string

Error returns a string of ErrInvalidOption.err.

func (*ErrInvalidOption) Unwrap added in v0.0.56

func (e *ErrInvalidOption) Unwrap() error

Unwrap returns an origin error of ErrInvalidOption.

type ErrMySQLInvalidArgumentIdentity

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

ErrMySQLInvalidArgumentIdentity represents a custom error type that the argument is not found.

func (*ErrMySQLInvalidArgumentIdentity) Error

Error returns the string of internal error.

func (*ErrMySQLInvalidArgumentIdentity) Unwrap added in v0.0.53

Unwrap returns the internal error.

type ErrMySQLNotFoundIdentity

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

ErrMySQLNotFoundIdentity represents a custom error type that the element is not found.

func (*ErrMySQLNotFoundIdentity) Error

func (e *ErrMySQLNotFoundIdentity) Error() string

Error returns the string of internal error.

func (*ErrMySQLNotFoundIdentity) Unwrap added in v0.0.53

func (e *ErrMySQLNotFoundIdentity) Unwrap() error

Unwrap returns the internal error.

type ErrRedisNotFoundIdentity

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

ErrRedisNotFoundIdentity represents a struct that includes err and has a method for Redis error handling.

func (*ErrRedisNotFoundIdentity) Error

func (e *ErrRedisNotFoundIdentity) Error() string

Error returns the string of ErrRedisNotFoundIdentity.error.

func (*ErrRedisNotFoundIdentity) Unwrap added in v0.0.53

func (e *ErrRedisNotFoundIdentity) Unwrap() error

Unwrap returns the error value of ErrRedisNotFoundIdentity.

Jump to

Keyboard shortcuts

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