Documentation
¶
Overview ¶
Package gqlerrors is a wrapper to define custom errors for the GraphQL server
Index ¶
Constants ¶
View Source
const ( // NotFoundErrorCode is the error code for not found errors NotFoundErrorCode = "NOT_FOUND" // ValidationErrorCode is the error code for validation errors ValidationErrorCode = "VALIDATION_ERROR" // ConflictErrorCode is the error code for conflict errors ConflictErrorCode = "CONFLICT" // InternalServerErrorCode is the error code for internal server errors InternalServerErrorCode = "INTERNAL_SERVER_ERROR" UnauthorizedErrorCode = "UNAUTHORIZED" // AlreadyExistsErrorCode is the error code for already exists errors AlreadyExistsErrorCode = "ALREADY_EXISTS" // MaxAttemptsErrorCode is the error code for max attempts errors MaxAttemptsErrorCode = "MAX_ATTEMPTS" // BadRequestErrorCode is the error code for bad request errors BadRequestErrorCode = "BAD_REQUEST" // NoAccessToModule is the error code for when an org has no access to a // specific schema and module NoAccessToModule = "MODULE_NO_ACCESS" )
Error code constants
View Source
const ( // ExtensionCodeKey is the key for the error code in the extensions ExtensionCodeKey = "code" // ExtensionMessageKey is the key for the error message in the extensions ExtensionMessageKey = "message" // ExtensionModuleKey is the key for the module that is required to get access to // the feature behind the graphql query ExtensionModuleKey = "module" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CustomError ¶
type CustomError struct {
// contains filtered or unexported fields
}
CustomError is a struct that implements the CustomErrorType interface
func NewCustomError ¶
func NewCustomError(code, message string, err error) CustomError
NewCustomError creates a new CustomError with the given code and error
func NewCustomErrorWithModule ¶ added in v0.28.0
func NewCustomErrorWithModule(code, message string, err error, module *models.OrgModule) CustomError
NewCustomErrorWithModule creates a custom error with the given code, error and module
func (CustomError) Code ¶
func (e CustomError) Code() string
Code satisfies the CustomErrorType interface
func (CustomError) Error ¶
func (e CustomError) Error() string
Error satisfies the CustomErrorType interface
func (CustomError) Message ¶
func (e CustomError) Message() string
Message satisfies the CustomErrorType interface
func (CustomError) Module ¶ added in v0.28.0
func (e CustomError) Module() models.OrgModule
Module satisfies the CustomError interface
type CustomErrorType ¶
type CustomErrorType interface {
error
// Code returns the static error code for the error in the gql extensions
Code() string
// Message returns the detailed error message for the error in the gql extensions
Message() string
// Module returns the module that failed checks for the query to succeed
Module() models.OrgModule
}
CustomErrorType is an interface that defines a custom error type
Click to show internal directories.
Click to hide internal directories.