errtypes

package
v2.26.7 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Overview

Package errtypes contains definitions for common errors. It would have nice to call this package errors, err or error but errors clashes with github.com/pkg/errors, err is used for any error variable and error is a reserved word :)

Index

Constants

View Source
const StatusChecksumMismatch = 419

StatusChecksumMismatch 419 is an unofficial http status code in an unassigned range that is used for checksum mismatches Proposed by https://stackoverflow.com/a/35665694 Official HTTP status code registry: https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Note: TUS uses unassigned 460 Checksum-Mismatch RFC proposal for checksum digest uses a `Want-Digest` header: https://tools.ietf.org/html/rfc3230 oc clienst issue: https://github.com/owncloud/core/issues/22711

View Source
const StatusInsufficientStorage = 507

StatusInsufficientStorage 507 is an official HTTP status code to indicate that there is insufficient storage https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/507

Variables

This section is empty.

Functions

func NewErrtypeFromHTTPStatusCode added in v2.16.0

func NewErrtypeFromHTTPStatusCode(code int, message string) error

NewErrtypeFromHTTPStatusCode maps a http status to an errtype

func NewErrtypeFromStatus

func NewErrtypeFromStatus(status *rpc.Status) error

NewErrtypeFromStatus maps a rpc status to an errtype

func NewHTTPStatusCodeFromErrtype added in v2.19.2

func NewHTTPStatusCodeFromErrtype(err error) int

NewHTTPStatusCodeFromErrtype maps an errtype to a http status

Types

type Aborted added in v2.6.1

type Aborted string

Aborted is the error to use when a client should retry at a higher level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence) request fails because a requested etag or lock ID mismatches.

HTTP Mapping: 412 Precondition Failed

func (Aborted) Error added in v2.6.1

func (e Aborted) Error() string

func (Aborted) IsAborted added in v2.6.1

func (e Aborted) IsAborted()

IsAborted implements the IsAborted interface.

type AlreadyExists

type AlreadyExists string

AlreadyExists is the error to use when a resource something is not found.

func (AlreadyExists) Error

func (e AlreadyExists) Error() string

func (AlreadyExists) IsAlreadyExists

func (e AlreadyExists) IsAlreadyExists()

IsAlreadyExists implements the IsAlreadyExists interface.

type BadRequest

type BadRequest string

BadRequest is the error to use when the server cannot or will not process the request (due to a client error). Reauthenticating won't help.

func (BadRequest) Error

func (e BadRequest) Error() string

func (BadRequest) IsBadRequest

func (e BadRequest) IsBadRequest()

IsBadRequest implements the IsBadRequest interface.

type ChecksumMismatch

type ChecksumMismatch string

ChecksumMismatch is the error to use when the transmitted hash does not match the calculated hash.

func (ChecksumMismatch) Error

func (e ChecksumMismatch) Error() string

func (ChecksumMismatch) IsChecksumMismatch

func (e ChecksumMismatch) IsChecksumMismatch()

IsChecksumMismatch implements the IsChecksumMismatch interface.

type InsufficientStorage

type InsufficientStorage string

InsufficientStorage is the error to use when there is insufficient storage.

func (InsufficientStorage) Body added in v2.4.1

func (e InsufficientStorage) Body() []byte

Body returns the error body. This implementation is needed to allow TUS to cast the correct http errors

func (InsufficientStorage) Error

func (e InsufficientStorage) Error() string

func (InsufficientStorage) IsInsufficientStorage

func (e InsufficientStorage) IsInsufficientStorage()

IsInsufficientStorage implements the IsInsufficientStorage interface.

func (InsufficientStorage) StatusCode added in v2.4.1

func (e InsufficientStorage) StatusCode() int

StatusCode returns StatusInsufficientStorage, this implementation is needed to allow TUS to cast the correct http errors.

type InternalError

type InternalError string

InternalError is the error to use when we really don't know what happened. Use with care

func (InternalError) Error

func (e InternalError) Error() string

func (InternalError) IsInternalError

func (e InternalError) IsInternalError()

IsInternalError implements the IsInternalError interface.

type InvalidCredentials

type InvalidCredentials string

InvalidCredentials is the error to use when receiving invalid credentials.

func (InvalidCredentials) Error

func (e InvalidCredentials) Error() string

func (InvalidCredentials) IsInvalidCredentials

func (e InvalidCredentials) IsInvalidCredentials()

IsInvalidCredentials implements the IsInvalidCredentials interface.

type IsAborted added in v2.6.1

type IsAborted interface {
	IsAborted()
}

IsAborted is the interface to implement to specify that a request was aborted.

type IsAlreadyExists

type IsAlreadyExists interface {
	IsAlreadyExists()
}

IsAlreadyExists is the interface to implement to specify that a resource already exists.

type IsBadRequest

type IsBadRequest interface {
	IsBadRequest()
}

IsBadRequest is the interface to implement to specify that the server cannot or will not process the request.

type IsChecksumMismatch

type IsChecksumMismatch interface {
	IsChecksumMismatch()
}

IsChecksumMismatch is the interface to implement to specify that a checksum does not match.

type IsInsufficientStorage

type IsInsufficientStorage interface {
	IsInsufficientStorage()
}

IsInsufficientStorage is the interface to implement to specify that there is insufficient storage.

type IsInternalError

type IsInternalError interface {
	IsInternalError()
}

IsInternalError is the interface to implement to specify that there was some internal error

type IsInvalidCredentials

type IsInvalidCredentials interface {
	IsInvalidCredentials()
}

IsInvalidCredentials is the interface to implement to specify that credentials were wrong.

type IsLocked

type IsLocked interface {
	IsLocked()
}

IsLocked is the interface to implement to specify that a resource is locked.

type IsNotFound

type IsNotFound interface {
	IsNotFound()
}

IsNotFound is the interface to implement to specify that a resource is not found.

type IsNotSupported

type IsNotSupported interface {
	IsNotSupported()
}

IsNotSupported is the interface to implement to specify that an action is not supported.

type IsPartialContent

type IsPartialContent interface {
	IsPartialContent()
}

IsPartialContent is the interface to implement to specify that the client request has partial data.

type IsPermissionDenied

type IsPermissionDenied interface {
	IsPermissionDenied()
}

IsPermissionDenied is the interface to implement to specify that an action is denied.

type IsPreconditionFailed

type IsPreconditionFailed interface {
	IsPreconditionFailed()
}

IsPreconditionFailed is the interface to implement to specify that a precondition failed.

type IsTooEarly added in v2.22.0

type IsTooEarly interface {
	IsTooEarly()
}

IsTooEarly is the interface to implement to specify that there is some not finished job over resource is still in process.

type IsUserRequired

type IsUserRequired interface {
	IsUserRequired()
}

IsUserRequired is the interface to implement to specify that a user is required.

type Locked

type Locked string

Locked is the error to use when a resource cannot be modified because of a lock.

func (Locked) Error

func (e Locked) Error() string

func (Locked) IsLocked

func (e Locked) IsLocked()

IsLocked implements the IsLocked interface.

func (Locked) LockID

func (e Locked) LockID() string

LockID returns the lock ID that caused this error

type NotFound

type NotFound string

NotFound is the error to use when a something is not found.

func (NotFound) Error

func (e NotFound) Error() string

func (NotFound) IsNotFound

func (e NotFound) IsNotFound()

IsNotFound implements the IsNotFound interface.

type NotModified added in v2.16.0

type NotModified string

NotModified is the error to use when a resource was not modified, e.g. the requested etag did not change.

func (NotModified) Error added in v2.16.0

func (e NotModified) Error() string

func (NotModified) IsNotModified added in v2.16.0

func (e NotModified) IsNotModified()

IsNotModified implements the IsNotModified interface.

func (NotModified) StatusCode added in v2.16.0

func (e NotModified) StatusCode() int

StatusCode returns StatusInsufficientStorage, this implementation is needed to allow TUS to cast the correct http errors.

type NotSupported

type NotSupported string

NotSupported is the error to use when an action is not supported.

func (NotSupported) Error

func (e NotSupported) Error() string

func (NotSupported) IsNotSupported

func (e NotSupported) IsNotSupported()

IsNotSupported implements the IsNotSupported interface.

type PartialContent

type PartialContent string

PartialContent is the error to use when the client request has partial data.

func (PartialContent) Error

func (e PartialContent) Error() string

func (PartialContent) IsPartialContent

func (e PartialContent) IsPartialContent()

IsPartialContent implements the IsPartialContent interface.

type PermissionDenied

type PermissionDenied string

PermissionDenied is the error to use when a resource cannot be access because of missing permissions.

func (PermissionDenied) Error

func (e PermissionDenied) Error() string

func (PermissionDenied) IsPermissionDenied

func (e PermissionDenied) IsPermissionDenied()

IsPermissionDenied implements the IsPermissionDenied interface.

type PreconditionFailed

type PreconditionFailed string

PreconditionFailed is the error to use when a client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, PreconditionFailed should be returned since the client should not retry unless the files are deleted from the directory. PreconditionFailed should also be returned when an intermediate directory for an MKCOL or PUT is missing.

FIXME rename to FailedPrecondition to make it less confusable with the http status Precondition Failed

HTTP Mapping: 400 Bad Request, 405 Method Not Allowed, 409 Conflict

func (PreconditionFailed) Error

func (e PreconditionFailed) Error() string

func (PreconditionFailed) IsPreconditionFailed

func (e PreconditionFailed) IsPreconditionFailed()

IsPreconditionFailed implements the IsPreconditionFailed interface.

type TooEarly added in v2.22.0

type TooEarly string

TooEarly is the error to use when some are not finished job over resource is still in process.

func (TooEarly) Error added in v2.22.0

func (e TooEarly) Error() string

func (TooEarly) IsTooEarly added in v2.22.0

func (e TooEarly) IsTooEarly()

IsTooEarly implements the IsTooEarly interface.

type UserRequired

type UserRequired string

UserRequired represents an error when a resource is not found.

func (UserRequired) Error

func (e UserRequired) Error() string

func (UserRequired) IsUserRequired

func (e UserRequired) IsUserRequired()

IsUserRequired implements the IsUserRequired interface.

Jump to

Keyboard shortcuts

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