errors

package
v2.0.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidDepth is an invalid depth header error
	ErrInvalidDepth = errors.New("webdav: invalid depth")
	// ErrInvalidPropfind is an invalid propfind error
	ErrInvalidPropfind = errors.New("webdav: invalid propfind")
	// ErrInvalidProppatch is an invalid proppatch error
	ErrInvalidProppatch = errors.New("webdav: invalid proppatch")
	// ErrInvalidLockInfo is an invalid lock error
	ErrInvalidLockInfo = errors.New("webdav: invalid lock info")
	// ErrUnsupportedLockInfo is an unsupported lock error
	ErrUnsupportedLockInfo = errors.New("webdav: unsupported lock info")
	// ErrInvalidTimeout is an invalid timeout error
	ErrInvalidTimeout = errors.New("webdav: invalid timeout")
	// ErrInvalidIfHeader is an invalid if header error
	ErrInvalidIfHeader = errors.New("webdav: invalid If header")
	// ErrUnsupportedMethod is an unsupported method error
	ErrUnsupportedMethod = errors.New("webdav: unsupported method")
	// ErrInvalidLockToken is an invalid lock token error
	ErrInvalidLockToken = errors.New("webdav: invalid lock token")
	// ErrConfirmationFailed is returned by a LockSystem's Confirm method.
	ErrConfirmationFailed = errors.New("webdav: confirmation failed")
	// ErrForbidden is returned by a LockSystem's Unlock method.
	ErrForbidden = errors.New("webdav: forbidden")
	// ErrLocked is returned by a LockSystem's Create, Refresh and Unlock methods.
	ErrLocked = errors.New("webdav: locked")
	// ErrNoSuchLock is returned by a LockSystem's Refresh and Unlock methods.
	ErrNoSuchLock = errors.New("webdav: no such lock")
	// ErrNotImplemented is returned when hitting not implemented code paths
	ErrNotImplemented = errors.New("webdav: not implemented")
)

Functions

func HandleErrorStatus

func HandleErrorStatus(log *zerolog.Logger, w http.ResponseWriter, s *rpc.Status)

HandleErrorStatus checks the status code, logs a Debug or Error level message and writes an appropriate http status

func HandleWebdavError

func HandleWebdavError(log *zerolog.Logger, w http.ResponseWriter, b []byte, err error)

HandleWebdavError checks the status code, logs an error and creates a webdav response body if needed

func Marshal

func Marshal(code int, message string, header string) ([]byte, error)

Marshal just calls the xml marshaller for a given exception.

func SabreException

func SabreException(code int) string

SabreException returns a sabre exception text for the HTTP status code. It returns the empty string if the code is unknown.

Types

type ErrorXML

type ErrorXML struct {
	XMLName   xml.Name `xml:"d:error"`
	Xmlnsd    string   `xml:"xmlns:d,attr"`
	Xmlnss    string   `xml:"xmlns:s,attr"`
	Exception string   `xml:"s:exception"`
	Message   string   `xml:"s:message"`
	InnerXML  []byte   `xml:",innerxml"`
	// Header is used to indicate the conflicting request header
	Header string `xml:"s:header,omitempty"`
}

ErrorXML holds the xml representation of an error http://www.webdav.org/specs/rfc4918.html#ELEMENT_error

type Exception

type Exception struct {
	Code    int
	Message string
	Header  string
}

Exception represents a ocdav exception

Jump to

Keyboard shortcuts

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