dbx_error

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MHandler = app_msg.Apply(&MsgHandler{}).(*MsgHandler)
)

Functions

func NewHandler

func NewHandler() rc_error_handler.ErrorHandler

Types

type DropboxError

type DropboxError interface {
	error

	Auth() ErrorAuth
	Access() ErrorAccess
	Path() ErrorEndpointPath
	Endpoint() ErrorEndpoint
	To() ErrorWrite
	BadPath() ErrorSharePath
	Member() ErrorMember

	HasPrefix(prefix string) bool

	// too_many_write_operations
	IsTooManyWriteOperations() bool
	// too_many_files
	IsTooManyFiles() bool
	// folder_name_already_used
	IsFolderNameAlreadyUsed() bool
	// group_name_already_used
	IsGroupNameAlreadyUsed() bool
	// duplicate user
	IsDuplicateUser() bool
	// member not in group
	IsMemberNotInGroup() bool
	// id not found
	IsIdNotFound() bool
	// shared_link_already_exists
	IsSharedLinkAlreadyExists() bool
	// It may not exist or may point to a deleted file.
	IsInvalidRevision() bool

	Summary() string
}

func NewErrors

func NewErrors(err error) DropboxError

type ErrorAccess

type ErrorAccess interface {
	// Current account type cannot access the resource.
	IsInvalidAccountType() bool
	// Current account cannot access Paper.
	IsPaperAccessDenied() bool
}

403: The user or team account doesn't have access to the endpoint or feature.

func NewErrorAccess

func NewErrorAccess(de ErrorInfo) ErrorAccess

type ErrorAuth

type ErrorAuth interface {
	// The access token is invalid.
	IsInvalidAccessToken() bool
	// The user specified in 'Dropbox-API-Select-User' is no longer on the team.
	IsInvalidSelectUser() bool
	// The user specified in 'Dropbox-API-Select-Admin' is not a Dropbox Business team admin.
	IsInvalidSelectAdmin() bool
	// The user has been suspended.
	IsUserSuspended() bool
	// The access token has expired.
	IsExpiredAccessToken() bool
	// The access token does not have the required scope to access the route.
	IsMissingScope() bool
	// The route is not available to public.
	IsRouteAccessDenied() bool
}

401: Bad or expired token. This can happen if the access token is expired or if the access token has been revoked by Dropbox or the user.

func NewErrorAuth

func NewErrorAuth(de ErrorInfo) ErrorAuth

type ErrorBadRequest

type ErrorBadRequest struct {
	Reason string `json:"reason"`
}

func (ErrorBadRequest) Error

func (z ErrorBadRequest) Error() string

type ErrorEndpoint

type ErrorEndpoint interface {
	IsRateLimit() bool
}

409: Other endpoint specific error

func NewErrorEndpoint

func NewErrorEndpoint(de ErrorInfo) ErrorEndpoint

type ErrorEndpointPath

type ErrorEndpointPath interface {
	// There is nothing at the given path.
	IsNotFound() bool
	// Not a file
	IsNotFile() bool
	// Not a folder
	IsNotFolder() bool
	// The given path does not satisfy the required path format
	IsMalformedPath() bool
	// Couldn't write to the target path because there was something in the way.
	IsConflict() bool
	// Couldn't write to the target path because there was something in the way.
	IsConflictFile() bool
	// Couldn't write to the target path because there was something in the way.
	IsConflictFolder() bool
	// There are too many write operations in user's Dropbox. Please retry this request.
	IsTooManyWriteOperations() bool
}

409: Endpoint specific error, Path

func NewErrorPath

func NewErrorPath(de ErrorInfo) ErrorEndpointPath

type ErrorInfo

type ErrorInfo struct {
	ErrorTag          string `path:"error.\\.tag" json:"error,omitempty"`
	ErrorSummary      string `path:"error_summary" json:"error_summary,omitempty"`
	UserMessageLocale string `path:"user_message.locale" json:"user_message_lang,omitempty"`
	UserMessage       string `path:"user_message.text" json:"user_message,omitempty"`
}

func (ErrorInfo) Error

func (z ErrorInfo) Error() string

func (ErrorInfo) HasPrefix

func (z ErrorInfo) HasPrefix(prefix string) bool

type ErrorMember

type ErrorMember interface {
	IsNotAMember() bool
}

409: ErrorMember

func NewErrorMember

func NewErrorMember(de ErrorInfo) ErrorMember

type ErrorSharePath

type ErrorSharePath interface {
	IsAlreadyShared() bool
}

409: SharePathError

func NewSharePath

func NewSharePath(prefix string, de ErrorInfo) ErrorSharePath

type ErrorWrite

type ErrorWrite interface {
	IsConflict() bool
}

409: WriteError

func NewErrorWrite

func NewErrorWrite(prefix string, de ErrorInfo) ErrorWrite

type MsgHandler

type MsgHandler struct {
	ErrorSummary    app_msg.Message
	ErrorBadRequest app_msg.Message
}

Jump to

Keyboard shortcuts

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