graphqlerrors

package
v2.0.0-rc.60 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorPath

type ErrorPath struct {
	// contains filtered or unexported fields
}

func (*ErrorPath) Len

func (e *ErrorPath) Len() int

func (*ErrorPath) MarshalJSON

func (e *ErrorPath) MarshalJSON() ([]byte, error)

func (*ErrorPath) String

func (e *ErrorPath) String() string

type Errors

type Errors interface {
	error
	WriteResponse(writer io.Writer) (n int, err error)
	Count() int
	ErrorByIndex(i int) error
}

type RequestError

type RequestError struct {
	Message   string                     `json:"message"`
	Locations []operationreport.Location `json:"locations,omitempty"`
	Path      ErrorPath                  `json:"path"`
}

func (RequestError) Error

func (o RequestError) Error() string

func (RequestError) MarshalJSON

func (o RequestError) MarshalJSON() ([]byte, error)

type RequestErrors

type RequestErrors []RequestError

func RequestErrorsFromError

func RequestErrorsFromError(err error) RequestErrors

func RequestErrorsFromOperationReport

func RequestErrorsFromOperationReport(report operationreport.Report) (errors RequestErrors)

func (RequestErrors) Count

func (o RequestErrors) Count() int

func (RequestErrors) Error

func (o RequestErrors) Error() string

func (RequestErrors) ErrorByIndex

func (o RequestErrors) ErrorByIndex(i int) error

func (RequestErrors) WriteResponse

func (o RequestErrors) WriteResponse(writer io.Writer) (n int, err error)

type Response

type Response struct {
	Errors Errors `json:"errors,omitempty"`
	Data   any    `json:"data"` // we add this here to ensure that "data":null is added to an error response
}

func (Response) Marshal

func (r Response) Marshal() ([]byte, error)

Jump to

Keyboard shortcuts

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