operationreport

package
v1.67.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 5 Imported by: 4

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 added in v1.53.0

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

func LocationsFromPosition added in v1.59.1

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

func UnwrappedErrorMessage added in v1.53.0

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 added in v1.59.1

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

func ErrArgumentNotDefinedOnField added in v1.59.1

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 added in v1.59.1

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 added in v1.64.0

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

func ErrDuplicatedFieldInputObject added in v1.59.1

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 added in v1.63.2

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

func ErrInvalidOperationType added in v1.64.1

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

func ErrMissingFieldSelectionOnNonScalar

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

func ErrMissingRequiredFieldOfInputObject added in v1.59.1

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

func ErrNullValueDoesntSatisfyInputValueDefinition added in v1.59.1

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 added in v1.64.1

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 added in v1.59.1

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

func ErrUnknownType added in v1.59.1

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

func ErrValueDoesntExistsInEnum added in v1.59.1

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

func ErrValueDoesntSatisfyBoolean added in v1.59.1

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

func ErrValueDoesntSatisfyEnum added in v1.59.1

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

func ErrValueDoesntSatisfyFloat added in v1.59.1

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

func ErrValueDoesntSatisfyID added in v1.59.1

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

func ErrValueDoesntSatisfyInt added in v1.59.1

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

func ErrValueDoesntSatisfyString added in v1.59.1

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

func ErrValueDoesntSatisfyType added in v1.59.1

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

func ErrValueIsNotAnInputObjectType added in v1.59.1

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 added in v1.59.1

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

type FormatExternalErrorMessage added in v1.53.0

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