Documentation ¶
Index ¶
- Variables
- func AllDetails(err error) map[string]interface{}
- func ByName(name string) error
- func IsNetworkError(err error) bool
- func IsStreamFinished(err error) bool
- func RegisterBaseSentinel(parent error, name string) error
- func Tag(err error, sentinel error) error
- func WithAPICode(base error, code ApiCode, kv ...interface{}) error
- func Zap(err error) zap.Field
- type ApiCode
- type E
- type Leaf
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CellsError is the parent of all errors CellsError = tozd.Base("cells") StatusInternalServerError = tozd.BaseWrap(CellsError, "internal") StatusForbidden = tozd.BaseWrap(CellsError, "forbidden") StatusTooManyRequests = tozd.BaseWrap(CellsError, "too many requests") StatusRequestTimeout = tozd.BaseWrap(CellsError, "timeout") StatusBadRequest = tozd.BaseWrap(CellsError, "bad request") StatusConflict = tozd.BaseWrap(CellsError, "conflict") StatusPreconditionFailed = tozd.BaseWrap(CellsError, "precondition failed") StatusNotImplemented = tozd.BaseWrap(CellsError, "not implemented") StatusNotFound = tozd.BaseWrap(CellsError, "not found") StatusCancelled = tozd.BaseWrap(CellsError, "cancelled") StatusAborted = tozd.BaseWrap(CellsError, "aborted") StatusOutOfRange = tozd.BaseWrap(CellsError, "out of range") StatusDataLoss = tozd.BaseWrap(CellsError, "data loss") StatusLocked = tozd.BaseWrap(CellsError, "locked") StatusQuotaReached = tozd.BaseWrap(CellsError, "quota reached") InvalidParameters = RegisterBaseSentinel(StatusBadRequest, "invalid parameters") UserNotFound = RegisterBaseSentinel(StatusNotFound, "user not found") NodeNotFound = RegisterBaseSentinel(StatusNotFound, "node not found") RecycleNotFound = RegisterBaseSentinel(StatusNotFound, "recycle not found") KeyNotFound = RegisterBaseSentinel(StatusNotFound, "key not found") BucketNotFound = RegisterBaseSentinel(StatusNotFound, "bucket not found") ObjectNotFound = RegisterBaseSentinel(StatusNotFound, "object not found") DatasourceNotFound = RegisterBaseSentinel(StatusNotFound, "datasource not found") RoleNotFound = RegisterBaseSentinel(StatusNotFound, "role not found") TemplateNotFound = RegisterBaseSentinel(StatusNotFound, "template not found") VersionNotFound = RegisterBaseSentinel(StatusNotFound, "version not found") JobNotFound = RegisterBaseSentinel(StatusNotFound, "job not found") ActionNotFound = RegisterBaseSentinel(StatusNotFound, "action not found") WorkspaceNotFound = RegisterBaseSentinel(StatusNotFound, "workspace not found") CellNotFound = RegisterBaseSentinel(WorkspaceNotFound, "cell not found") DatasourceConflict = RegisterBaseSentinel(StatusConflict, "datasource conflict") NodeTypeConflict = RegisterBaseSentinel(StatusConflict, "file / folder type conflict") NodeIndexConflict = RegisterBaseSentinel(StatusConflict, "index mpath conflict") UserLocked = RegisterBaseSentinel(StatusUnauthorized, "user is locked") LoginNotAllowed = RegisterBaseSentinel(StatusUnauthorized, "login not allowed") LoginFailed = RegisterBaseSentinel(StatusUnauthorized, "login failed") InvalidIDToken = RegisterBaseSentinel(StatusUnauthorized, "invalid id_token") EmptyIDToken = RegisterBaseSentinel(InvalidIDToken, "empty idToken") ExpiredIDToken = RegisterBaseSentinel(InvalidIDToken, "expired idToken") AccessListNotFound = RegisterBaseSentinel(StatusForbidden, "access list not found") ContextUserNotFound = RegisterBaseSentinel(StatusForbidden, "context user not found") ExtensionsNotAllowed = RegisterBaseSentinel(StatusForbidden, "extensions not allowed") OutOfAccessibleWorkspaces = RegisterBaseSentinel(StatusForbidden, "node does not belong to any accessible workspace") FileLocked = RegisterBaseSentinel(StatusForbidden, "file locked") RoleACLsNotEditable = RegisterBaseSentinel(StatusForbidden, "role ACLs not editable") RoleNotAssignable = RegisterBaseSentinel(StatusForbidden, "role not assignable") NamespaceNotAllowed = RegisterBaseSentinel(StatusForbidden, "namespace not allowed") DAO = RegisterBaseSentinel(StatusInternalServerError, "dao") ResolveError = RegisterBaseSentinel(DAO, "dao resolution failed") SqlDAO = RegisterBaseSentinel(DAO, "sql") MongoDAO = RegisterBaseSentinel(DAO, "mongo") BoltDAO = RegisterBaseSentinel(DAO, "bolt") BleveDAO = RegisterBaseSentinel(DAO, "bleve") PathNotReadable = RegisterBaseSentinel(StatusForbidden, "path.not.readable") PathNotWriteable = RegisterBaseSentinel(StatusForbidden, "path.not.writeable") PathReadonly = RegisterBaseSentinel(StatusForbidden, "path.readonly") PathExplicitDeny = RegisterBaseSentinel(StatusForbidden, "explicit.deny") PathDownloadForbidden = RegisterBaseSentinel(StatusForbidden, "download.forbidden") PathUploadForbidden = RegisterBaseSentinel(StatusForbidden, "upload.forbidden") PathDeleteForbidden = RegisterBaseSentinel(StatusForbidden, "delete.forbidden") CellNotEditable = RegisterBaseSentinel(StatusForbidden, "cell not editable") UnmarshalError = RegisterBaseSentinel(StatusInternalServerError, "unmarshal error") RestInputError = RegisterBaseSentinel(StatusBadRequest, "rest input error") RestOutputWriteError = RegisterBaseSentinel(StatusBadRequest, "rest output write error") BinaryCannotReadStore = RegisterBaseSentinel(StatusForbidden, "cannot read store") BinaryCannotWriteStore = RegisterBaseSentinel(StatusForbidden, "cannot write store") BranchInfoMissing = RegisterBaseSentinel(StatusInternalServerError, "branch info missing") BranchInfoRootMissing = RegisterBaseSentinel(StatusInternalServerError, "branch info root missing") BranchInfoACLMissing = RegisterBaseSentinel(StatusInternalServerError, "branch info ACL missing") ServiceError = RegisterBaseSentinel(StatusInternalServerError, "service error") ServiceStartError = RegisterBaseSentinel(ServiceError, "service start error") ServiceNoServerAttached = RegisterBaseSentinel(ServiceError, "no server attached") )
View Source
var ( // New creates an error including a stack trace New = tozd.New // Errorf creates an error including a stack trace. You can use %w to reference a known sentinel or another error. Errorf = tozd.Errorf // WithDetails appends details to an error, eventually recording a stack trace WithDetails = tozd.WithDetails // WithStack records a stack trace using a Sentinel error WithStack = tozd.WithStack // WithMessage initialize a Sentinel error with a message and records a stack trace WithMessage = tozd.WithMessage // WithMessagef initialize a Sentinel error with formatting arguments WithMessagef = tozd.WithMessagef // Details reads the map[string]interface{} details of a given error (not recursively unwrapping) Details = tozd.Details Join = tozd.Join // Is replaces stdlib.Is Is = tozd.Is // As replaces stdlib.As As = tozd.As )
Functions ¶
func AllDetails ¶
AllDetails stacks all Details from all unwrapped errors. It overrides tozd version to avoid stopping on Cause() case and to gather joined errors details
func IsNetworkError ¶
IsNetworkError tries to detect if error is a network error.
func IsStreamFinished ¶
func RegisterBaseSentinel ¶
func Tag ¶
Tag an existing error with a known sentinel. If it is already responding to Is(er, sentinel), it will be unmodified.
func WithAPICode ¶
WithAPICode adds APICode and optional formatting arguments as error Details It does not override an existing APICode
Types ¶
type ApiCode ¶
type ApiCode string
const ( ApiInternalServerError ApiCode = "E_INTERNAL_SERVER_ERROR" ApiForbidden ApiCode = "E_FORBIDDEN" ApiNotFound ApiCode = "E_NOT_FOUND" ApiResourceLocked ApiCode = "E_RESOURCE_LOCKED" ApiForbiddenEdit ApiCode = "E_FORBIDDEN_EDIT" ApiForbiddenRead ApiCode = "E_FORBIDDEN_READ" ApiLoginFailed ApiCode = "E_LOGIN_FAILED" ApiUserAlreadyExists ApiCode = "E_USER_ALREADY_EXISTS" ApiUserLocked ApiCode = "E_USER_LOCKED" ApiUserNotEditable ApiCode = "E_USER_NOT_EDITABLE" ApiUserCannotCreate ApiCode = "E_USER_CANNOT_CREATE" ApiUserCannotCreateProfile ApiCode = "E_USER_CANNOT_CREATE_PROFILE" ApiUserCannotDeleteOwn ApiCode = "E_USER_CANNOT_DELETE_OWN" ApiUserCannotIncreaseProfile ApiCode = "E_USER_CANNOT_INCREASE_PROFILE" ApiGroupCannotCreate ApiCode = "E_GROUP_CANNOT_CREATE" ApiGroupCannotDeleteOwn ApiCode = "E_GROUP_CANNOT_DELETE_OWN" ApiWorkspaceNotFound ApiCode = "E_WORKSPACE_NOT_FOUND" ApiWorkspaceNotEditable ApiCode = "E_WORKSPACE_NOT_EDITABLE" )
func HasApiCode ¶
Click to show internal directories.
Click to hide internal directories.