Documentation ¶
Overview ¶
Package errors contains custom error codes that are sent to clients.
Index ¶
- Constants
- Variables
- func AssertionsNotForAuthorizationModelFound(modelID string) error
- func AuthorizationModelNotFound(modelID string) error
- func ConvertToEncodedErrorCode(statusError *status.Status) int32
- func DuplicateTupleInWrite(tk tuple.TupleWithoutCondition) error
- func ExceededEntityLimit(entity string, limit int) error
- func HandleError(public string, err error) error
- func HandleTupleValidateError(err error) error
- func InvalidAuthorizationModelInput(err error) error
- func IsValidEncodedError(errorCode int32) bool
- func LatestAuthorizationModelNotFound(store string) error
- func RelationNotFound(relation string, objectType string, tk *openfgav1.TupleKey) error
- func TypeNotFound(objectType string) error
- func ValidationError(cause error) error
- func WriteFailedDueToInvalidInput(err error) error
- type EncodedError
- type ErrorResponse
- type InternalError
Constants ¶
View Source
const InternalServerErrorMsg = "Internal Server Error"
Variables ¶
View Source
var ( // AuthorizationModelResolutionTooComplex is used to avoid stack overflows AuthorizationModelResolutionTooComplex = status.Error(codes.Code(openfgav1.ErrorCode_authorization_model_resolution_too_complex), "Authorization Model resolution required too many rewrite rules to be resolved. Check your authorization model for infinite recursion or too much nesting") InvalidWriteInput = status.Error(codes.Code(openfgav1.ErrorCode_invalid_write_input), "Invalid input. Make sure you provide at least one write, or at least one delete") InvalidContinuationToken = status.Error(codes.Code(openfgav1.ErrorCode_invalid_continuation_token), "Invalid continuation token") InvalidCheckInput = status.Error(codes.Code(openfgav1.ErrorCode_invalid_check_input), "Invalid input. Make sure you provide a user, object and relation") InvalidExpandInput = status.Error(codes.Code(openfgav1.ErrorCode_invalid_expand_input), "Invalid input. Make sure you provide an object and a relation") UnsupportedUserSet = status.Error(codes.Code(openfgav1.ErrorCode_unsupported_user_set), "Userset is not supported (right now)") StoreIDNotFound = status.Error(codes.Code(openfgav1.NotFoundErrorCode_store_id_not_found), "Store ID not found") MismatchObjectType = status.Error(codes.Code(openfgav1.ErrorCode_query_string_type_continuation_token_mismatch), "The type in the querystring and the continuation token don't match") RequestCancelled = status.Error(codes.Code(openfgav1.InternalErrorCode_cancelled), "Request Cancelled") )
Functions ¶
func DuplicateTupleInWrite ¶
func DuplicateTupleInWrite(tk tuple.TupleWithoutCondition) error
func ExceededEntityLimit ¶
func HandleError ¶
HandleError is used to hide internal errors from users. Use `public` to return an error message to the user.
func HandleTupleValidateError ¶
HandleTupleValidateError provide common routines for handling tuples validation error
func IsValidEncodedError ¶
IsValidEncodedError returns whether the error code is a valid encoded error
func RelationNotFound ¶
func TypeNotFound ¶
func ValidationError ¶
Types ¶
type EncodedError ¶
type EncodedError struct { HTTPStatusCode int GRPCStatusCode codes.Code ActualError ErrorResponse }
EncodedError allows customized error with code in string and specified http status field
func NewEncodedError ¶
func NewEncodedError(errorCode int32, message string) *EncodedError
NewEncodedError returns the encoded error with the correct http status code etc.
func (*EncodedError) Code ¶
func (e *EncodedError) Code() string
Code returns the encoded code in string
func (*EncodedError) CodeValue ¶
func (e *EncodedError) CodeValue() int32
CodeValue returns the encoded code in integer
func (*EncodedError) Error ¶
func (e *EncodedError) Error() string
Error returns the encoded message
func (*EncodedError) GRPCStatus ¶
func (e *EncodedError) GRPCStatus() *status.Status
func (*EncodedError) HTTPStatus ¶
func (e *EncodedError) HTTPStatus() int
HTTPStatus returns the HTTP Status code
type ErrorResponse ¶
type InternalError ¶
type InternalError struct {
// contains filtered or unexported fields
}
func NewInternalError ¶
func NewInternalError(public string, internal error) InternalError
func (InternalError) Error ¶
func (e InternalError) Error() string
func (InternalError) Internal ¶
func (e InternalError) Internal() error
func (InternalError) InternalError ¶
func (e InternalError) InternalError() string
func (InternalError) Is ¶
func (e InternalError) Is(target error) bool
Click to show internal directories.
Click to hide internal directories.