Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseError ¶
type BaseError struct {
Err error
}
BaseError is the base error type for all errors in the Foundation framework.
func (*BaseError) GRPCStatus ¶
GRPCStatus returns a gRPC status error for the Foundation error.
type ErrorCode ¶
type ErrorCode string
ErrorCode describes an error code.
const ( ErrorCodeAccepted ErrorCode = "Accepted" // ErrorCodeAccepted - Must be accepted ErrorCodeBlank ErrorCode = "Blank" // ErrorCodeBlank - Can't be blank ErrorCodeEmpty ErrorCode = "Empty" // ErrorCodeEmpty - Can't be empty ErrorCodeEven ErrorCode = "Even" // ErrorCodeEven - Must be even ErrorCodeExclusion ErrorCode = "Exclusion" // ErrorCodeExclusion - Is reserved ErrorCodeInclusion ErrorCode = "Inclusion" // ErrorCodeInclusion - Is not included in the list ErrorCodeInvalid ErrorCode = "Invalid" // ErrorCodeInvalid - Is invalid ErrorCodeNotANumber ErrorCode = "NotANumber" // ErrorCodeNotANumber - Is not a number ErrorCodeNotAnInteger ErrorCode = "NotAnInteger" // ErrorCodeNotAnInteger - Must be an integer ErrorCodeOdd ErrorCode = "Odd" // ErrorCodeOdd - Must be odd ErrorCodePresent ErrorCode = "Present" // ErrorCodePresent - Must be blank ErrorCodeRequired ErrorCode = "Required" // ErrorCodeRequired - Must exist ErrorCodeTaken ErrorCode = "Taken" // ErrorCodeTaken - Has already been taken )
Generic error codes.
type ErrorViolations ¶
ErrorViolations describes a map of field names to error codes.
type FoundationError ¶
type FoundationError interface { error GRPCStatus() *status.Status MarshalProto() proto.Message MarshalJSON() ([]byte, error) }
FoundationError describes an interface for all errors in the Foundation framework.
type InternalError ¶
type InternalError struct {
*BaseError
}
InternalError describes an internal error
func NewInternalError ¶
func NewInternalError(err error, msg string) *InternalError
NewInternalError creates a generic internal error.
func (*InternalError) GRPCStatus ¶
func (e *InternalError) GRPCStatus() *status.Status
func (*InternalError) MarshalJSON ¶
func (e *InternalError) MarshalJSON() ([]byte, error)
func (*InternalError) MarshalProto ¶
func (e *InternalError) MarshalProto() proto.Message
MarshalProto marshals the error to a proto.Message.
type InvalidArgumentError ¶
type InvalidArgumentError struct { *BaseError Kind string ID string Violations ErrorViolations }
InvalidArgumentError describes an invalid argument error.
func NewInvalidArgumentError ¶
func NewInvalidArgumentError(kind string, id string, violations map[string][]fmt.Stringer) *InvalidArgumentError
NewInvalidArgumentError creates an invalid argument error with error details.
func (*InvalidArgumentError) GRPCStatus ¶
func (e *InvalidArgumentError) GRPCStatus() *status.Status
func (*InvalidArgumentError) MarshalJSON ¶
func (e *InvalidArgumentError) MarshalJSON() ([]byte, error)
MarshalJSON marshals the error to JSON.
func (*InvalidArgumentError) MarshalProto ¶
func (e *InvalidArgumentError) MarshalProto() proto.Message
MarshalProto marshals the error to a proto.Message.
type NotFoundError ¶
NotFoundError describes a not found error.
func NewNotFoundError ¶
func NewNotFoundError(err error, kind string, id string) *NotFoundError
NewNotFoundError creates a not found error.
func (*NotFoundError) GRPCStatus ¶
func (e *NotFoundError) GRPCStatus() *status.Status
func (*NotFoundError) MarshalJSON ¶
func (e *NotFoundError) MarshalJSON() ([]byte, error)
MarshalJSON marshals the error to JSON.
func (*NotFoundError) MarshalProto ¶
func (e *NotFoundError) MarshalProto() proto.Message
MarshalProto marshals the error to a proto.Message.
type PermissionDeniedError ¶
PermissionDeniedError describes a permission denied error.
func NewInsufficientScopeAllError ¶
func NewInsufficientScopeAllError(expectedScopes ...string) *PermissionDeniedError
NewInsufficientScopeAllError creates an error for cases where all the expected scopes are required.
func NewInsufficientScopeAnyError ¶
func NewInsufficientScopeAnyError(expectedScopes ...string) *PermissionDeniedError
NewInsufficientScopeAnyError creates an error for cases where any of the expected scopes is required.
func NewPermissionDeniedError ¶
func NewPermissionDeniedError(action string, kind string, id string) *PermissionDeniedError
NewPermissionDeniedError creates a permission denied error.
func (*PermissionDeniedError) GRPCStatus ¶
func (e *PermissionDeniedError) GRPCStatus() *status.Status
func (*PermissionDeniedError) MarshalJSON ¶
func (e *PermissionDeniedError) MarshalJSON() ([]byte, error)
MarshalJSON marshals the error to JSON.
func (*PermissionDeniedError) MarshalProto ¶
func (e *PermissionDeniedError) MarshalProto() proto.Message
MarshalProto marshals the error to a proto.Message.
type StaleObjectError ¶
type StaleObjectError struct { *BaseError Kind string ID string ActualVersion int32 ExpectedVersion int32 }
StaleObjectError describes a stale object error.
func NewStaleObjectError ¶
func NewStaleObjectError(kind string, id string, actualVersion, expectedVersion int32) *StaleObjectError
NewStaleObjectError creates a stale object error.
func (*StaleObjectError) GRPCStatus ¶
func (e *StaleObjectError) GRPCStatus() *status.Status
func (*StaleObjectError) MarshalJSON ¶
func (e *StaleObjectError) MarshalJSON() ([]byte, error)
MarshalJSON marshals the error to JSON.
func (*StaleObjectError) MarshalProto ¶
func (e *StaleObjectError) MarshalProto() proto.Message
MarshalProto marshals the error to a proto.Message.
type UnauthenticatedError ¶
type UnauthenticatedError struct {
*BaseError
}
UnauthenticatedError describes an unauthenticated error.
func NewUnauthenticatedError ¶
func NewUnauthenticatedError(msg string) *UnauthenticatedError
NewUnauthenticatedError creates an unauthenticated error.
func (*UnauthenticatedError) GRPCStatus ¶
func (e *UnauthenticatedError) GRPCStatus() *status.Status
func (*UnauthenticatedError) MarshalJSON ¶
func (e *UnauthenticatedError) MarshalJSON() ([]byte, error)
MarshalJSON marshals the error to JSON.
func (*UnauthenticatedError) MarshalProto ¶
func (e *UnauthenticatedError) MarshalProto() proto.Message
MarshalProto marshals the error to a proto.Message.