operationreport

package
v0.0.0-...-5e166c9 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package operationreport helps generating the errors object for a GraphQL Operation.

Index

Constants

View Source
const (
	NotCompatibleTypeErrMsg                 = "%s cannot represent value: %s"
	NotStringErrMsg                         = "%s cannot represent a non string value: %s"
	NotIntegerErrMsg                        = "%s cannot represent non-integer value: %s"
	BigIntegerErrMsg                        = "%s cannot represent non 32-bit signed integer value: %s"
	NotFloatErrMsg                          = "%s cannot represent non numeric value: %s"
	NotBooleanErrMsg                        = "%s cannot represent a non boolean value: %s"
	NotIDErrMsg                             = "%s cannot represent a non-string and non-integer value: %s"
	NotEnumErrMsg                           = `Enum "%s" cannot represent non-enum value: %s.`
	NotAnEnumMemberErrMsg                   = `Value "%s" does not exist in "%s" enum.`
	NullValueErrMsg                         = `Expected value of type "%s", found null.`
	UnknownArgumentOnDirectiveErrMsg        = `Unknown argument "%s" on directive "@%s".`
	UnknownArgumentOnFieldErrMsg            = `Unknown argument "%s" on field "%s.%s".`
	UnknownTypeErrMsg                       = `Unknown type "%s".`
	VariableIsNotInputTypeErrMsg            = `Variable "$%s" cannot be non-input type "%s".`
	MissingRequiredFieldOfInputObjectErrMsg = `Field "%s.%s" of required type "%s" was not provided.`
	UnknownFieldOfInputObjectErrMsg         = `Field "%s" is not defined by type "%s".`
	DuplicatedFieldInputObjectErrMsg        = `There can be only one input field named "%s".`
	ValueIsNotAnInputObjectTypeErrMsg       = `Expected value of type "%s", found %s.`
)

Variables

This section is empty.

Functions

func ExternalErrorMessage

func ExternalErrorMessage(err error, formatFunction FormatExternalErrorMessage) (message string, ok bool)

func LocationsFromPosition

func LocationsFromPosition(position ...position.Position) []graphqlerrors.Location

func UnwrappedErrorMessage

func UnwrappedErrorMessage(err error) string

Types

type ExternalError

type ExternalError struct {
	Message   string                   `json:"message"`
	Path      ast.Path                 `json:"path"`
	Locations []graphqlerrors.Location `json:"locations"`
}

func ErrAnonymousOperationMustBeTheOnlyOperationInDocument

func ErrAnonymousOperationMustBeTheOnlyOperationInDocument() (err ExternalError)

func ErrArgumentMustBeUnique

func ErrArgumentMustBeUnique(argName ast.ByteSlice) (err ExternalError)

func ErrArgumentNotDefinedOnDirective

func ErrArgumentNotDefinedOnDirective(argName, directiveName ast.ByteSlice, position position.Position) (err ExternalError)

func ErrArgumentNotDefinedOnField

func ErrArgumentNotDefinedOnField(argName, typeName, fieldName ast.ByteSlice, position position.Position) (err ExternalError)

func ErrArgumentOnFieldMustNotBeNull

func ErrArgumentOnFieldMustNotBeNull(argName, fieldName ast.ByteSlice) (err ExternalError)

func ErrArgumentRequiredOnField

func ErrArgumentRequiredOnField(argName, fieldName ast.ByteSlice) (err ExternalError)

func ErrBigIntValueDoesntSatisfyInt

func ErrBigIntValueDoesntSatisfyInt(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrDifferingFieldsOnPotentiallySameType

func ErrDifferingFieldsOnPotentiallySameType(objectName ast.ByteSlice) (err ExternalError)

func ErrDirectiveMustBeUniquePerLocation

func ErrDirectiveMustBeUniquePerLocation(directiveName ast.ByteSlice, position, duplicatePosition position.Position) (err ExternalError)

func ErrDirectiveNotAllowedOnNode

func ErrDirectiveNotAllowedOnNode(directiveName, nodeKindName ast.ByteSlice) (err ExternalError)

func ErrDirectiveUndefined

func ErrDirectiveUndefined(directiveName ast.ByteSlice) (err ExternalError)

func ErrDocumentDoesntContainExecutableOperation

func ErrDocumentDoesntContainExecutableOperation() (err ExternalError)

func ErrDuplicateFieldsMustBeIdentical

func ErrDuplicateFieldsMustBeIdentical(fieldName, parentName, typeOne, typeTwo string) (err ExternalError)

func ErrDuplicatedFieldInputObject

func ErrDuplicatedFieldInputObject(fieldName ast.ByteSlice, first, duplicated position.Position) (err ExternalError)

func ErrEntitiesMustNotBeDuplicated

func ErrEntitiesMustNotBeDuplicated(typeName string) (err ExternalError)

func ErrEntityExtensionMustHaveKeyDirective

func ErrEntityExtensionMustHaveKeyDirective(typeName string) (err ExternalError)

func ErrEnumTypeUndefined

func ErrEnumTypeUndefined(enumName ast.ByteSlice) (err ExternalError)

func ErrEnumValueNameMustBeUnique

func ErrEnumValueNameMustBeUnique(enumName, enumValueName ast.ByteSlice) (err ExternalError)

func ErrExtensionOrphansMustResolveInSupergraph

func ErrExtensionOrphansMustResolveInSupergraph(extensionNameBytes []byte) (err ExternalError)

func ErrExtensionWithKeyDirectiveMustExtendEntity

func ErrExtensionWithKeyDirectiveMustExtendEntity(typeName string) (err ExternalError)

func ErrFieldNameMustBeUniqueOnType

func ErrFieldNameMustBeUniqueOnType(fieldName, typeName ast.ByteSlice) (err ExternalError)

func ErrFieldSelectionOnScalar

func ErrFieldSelectionOnScalar(fieldName, scalarTypeName ast.ByteSlice) (err ExternalError)

func ErrFieldSelectionOnUnion

func ErrFieldSelectionOnUnion(fieldName, unionName ast.ByteSlice) (err ExternalError)

func ErrFieldUndefinedOnType

func ErrFieldUndefinedOnType(fieldName, typeName ast.ByteSlice) (err ExternalError)

func ErrFieldsConflict

func ErrFieldsConflict(objectName, leftType, rightType ast.ByteSlice) (err ExternalError)

func ErrFragmentDefinedButNotUsed

func ErrFragmentDefinedButNotUsed(fragmentName ast.ByteSlice) (err ExternalError)

func ErrFragmentDefinitionMustBeUnique

func ErrFragmentDefinitionMustBeUnique(fragmentName ast.ByteSlice) (err ExternalError)

func ErrFragmentDefinitionOnTypeDisallowed

func ErrFragmentDefinitionOnTypeDisallowed(fragmentName, onTypeName ast.ByteSlice) (err ExternalError)

func ErrFragmentSpreadFormsCycle

func ErrFragmentSpreadFormsCycle(spreadName ast.ByteSlice) (err ExternalError)

func ErrFragmentUndefined

func ErrFragmentUndefined(fragmentName ast.ByteSlice) (err ExternalError)

func ErrImplementingTypeDoesNotHaveFields

func ErrImplementingTypeDoesNotHaveFields(typeName ast.ByteSlice) (err ExternalError)

func ErrInlineFragmentOnTypeDisallowed

func ErrInlineFragmentOnTypeDisallowed(onTypeName ast.ByteSlice) (err ExternalError)

func ErrInlineFragmentOnTypeMismatchEnclosingType

func ErrInlineFragmentOnTypeMismatchEnclosingType(fragmentTypeName, enclosingTypeName ast.ByteSlice) (err ExternalError)

func ErrInputObjectTypeUndefined

func ErrInputObjectTypeUndefined(inputObjectName ast.ByteSlice) (err ExternalError)

func ErrInterfaceTypeUndefined

func ErrInterfaceTypeUndefined(interfaceName ast.ByteSlice) (err ExternalError)

func ErrInvalidFragmentSpread

func ErrInvalidFragmentSpread(fragmentName, fragmentTypeName, enclosingName ast.ByteSlice) (err ExternalError)

func ErrInvalidOperationType

func ErrInvalidOperationType(operationType ast.OperationType) (err ExternalError)

func ErrMissingFieldSelectionOnNonScalar

func ErrMissingFieldSelectionOnNonScalar(fieldName, enclosingTypeName ast.ByteSlice) (err ExternalError)

func ErrMissingRequiredFieldOfInputObject

func ErrMissingRequiredFieldOfInputObject(objName, fieldName, typeName ast.ByteSlice, position position.Position) (err ExternalError)

func ErrNullValueDoesntSatisfyInputValueDefinition

func ErrNullValueDoesntSatisfyInputValueDefinition(inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrOnlyOneMutationTypeAllowed

func ErrOnlyOneMutationTypeAllowed() (err ExternalError)

func ErrOnlyOneQueryTypeAllowed

func ErrOnlyOneQueryTypeAllowed() (err ExternalError)

func ErrOnlyOneSubscriptionTypeAllowed

func ErrOnlyOneSubscriptionTypeAllowed() (err ExternalError)

func ErrOperationNameMustBeUnique

func ErrOperationNameMustBeUnique(operationName ast.ByteSlice) (err ExternalError)

func ErrOperationTypeUndefined

func ErrOperationTypeUndefined(operationType ast.OperationType) (err ExternalError)

func ErrOperationWithProvidedOperationNameNotFound

func ErrOperationWithProvidedOperationNameNotFound(operationName string) (err ExternalError)

func ErrRequiredOperationNameIsMissing

func ErrRequiredOperationNameIsMissing() (err ExternalError)

func ErrResponseOfDifferingTypesMustBeOfSameShape

func ErrResponseOfDifferingTypesMustBeOfSameShape(leftObjectName, rightObjectName ast.ByteSlice) (err ExternalError)

func ErrScalarTypeUndefined

func ErrScalarTypeUndefined(scalarName ast.ByteSlice) (err ExternalError)

func ErrSharedTypesMustBeIdenticalToFederate

func ErrSharedTypesMustBeIdenticalToFederate(typeName string) (err ExternalError)

func ErrSharedTypesMustNotBeExtended

func ErrSharedTypesMustNotBeExtended(typeName string) (err ExternalError)

func ErrSubscriptionMustOnlyHaveOneRootSelection

func ErrSubscriptionMustOnlyHaveOneRootSelection(subscriptionName ast.ByteSlice) (err ExternalError)

func ErrTransitiveInterfaceExtensionImplementingWithoutBody

func ErrTransitiveInterfaceExtensionImplementingWithoutBody(interfaceExtensionName ast.ByteSlice) (err ExternalError)

func ErrTransitiveInterfaceNotImplemented

func ErrTransitiveInterfaceNotImplemented(typeName, transitiveInterfaceName ast.ByteSlice) (err ExternalError)

func ErrTypeBodyMustNotBeEmpty

func ErrTypeBodyMustNotBeEmpty(definitionType, typeName string) (err ExternalError)

func ErrTypeDoesNotImplementFieldFromInterface

func ErrTypeDoesNotImplementFieldFromInterface(typeName, interfaceName, fieldName ast.ByteSlice) (err ExternalError)

func ErrTypeNameMustBeUnique

func ErrTypeNameMustBeUnique(typeName ast.ByteSlice) (err ExternalError)

func ErrTypeUndefined

func ErrTypeUndefined(typeName ast.ByteSlice) (err ExternalError)

func ErrTypesForFieldMismatch

func ErrTypesForFieldMismatch(objectName, leftType, rightType ast.ByteSlice) (err ExternalError)

func ErrUnionMembersMustBeUnique

func ErrUnionMembersMustBeUnique(unionName, memberName ast.ByteSlice) (err ExternalError)

func ErrUnionTypeUndefined

func ErrUnionTypeUndefined(unionName ast.ByteSlice) (err ExternalError)

func ErrUnknownFieldOfInputObject

func ErrUnknownFieldOfInputObject(objName, fieldName ast.ByteSlice, position position.Position) (err ExternalError)

func ErrUnknownType

func ErrUnknownType(typeName ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntExistsInEnum

func ErrValueDoesntExistsInEnum(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyBoolean

func ErrValueDoesntSatisfyBoolean(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyEnum

func ErrValueDoesntSatisfyEnum(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyFloat

func ErrValueDoesntSatisfyFloat(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyID

func ErrValueDoesntSatisfyID(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyInt

func ErrValueDoesntSatisfyInt(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyString

func ErrValueDoesntSatisfyString(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueDoesntSatisfyType

func ErrValueDoesntSatisfyType(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrValueIsNotAnInputObjectType

func ErrValueIsNotAnInputObjectType(value, inputType ast.ByteSlice, position position.Position) (err ExternalError)

func ErrVariableDefinedButNeverUsed

func ErrVariableDefinedButNeverUsed(variableName, operationName ast.ByteSlice) (err ExternalError)

func ErrVariableMustBeUnique

func ErrVariableMustBeUnique(variableName, operationName ast.ByteSlice) (err ExternalError)

func ErrVariableNotDefinedOnArgument

func ErrVariableNotDefinedOnArgument(variableName, argumentName ast.ByteSlice) (err ExternalError)

func ErrVariableNotDefinedOnOperation

func ErrVariableNotDefinedOnOperation(variableName, operationName ast.ByteSlice) (err ExternalError)

func ErrVariableOfTypeIsNoValidInputValue

func ErrVariableOfTypeIsNoValidInputValue(variableName, ofTypeName ast.ByteSlice, position position.Position) (err ExternalError)

func ErrVariableTypeDoesntSatisfyInputValueDefinition

func ErrVariableTypeDoesntSatisfyInputValueDefinition(value, inputType, expectedType ast.ByteSlice, valuePos, variableDefinitionPos position.Position) (err ExternalError)

type FormatExternalErrorMessage

type FormatExternalErrorMessage func(report *Report) string

type Report

type Report struct {
	InternalErrors []error
	ExternalErrors []ExternalError
}

func (*Report) AddExternalError

func (r *Report) AddExternalError(gqlError ExternalError)

func (*Report) AddInternalError

func (r *Report) AddInternalError(err error)

func (Report) Error

func (r Report) Error() string

func (*Report) HasErrors

func (r *Report) HasErrors() bool

func (*Report) Reset

func (r *Report) Reset()

Jump to

Keyboard shortcuts

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