errcode

package
v0.17.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 1 Imported by: 156

Documentation

Index

Constants

View Source
const (
	ValidationFailed = "GRAPHQL_VALIDATION_FAILED"
	ParseFailed      = "GRAPHQL_PARSE_FAILED"
)

Variables

This section is empty.

Functions

func RegisterErrorType

func RegisterErrorType(code string, kind ErrorKind)

RegisterErrorType should be called by extensions that want to customize the http status codes for errors they return

func Set

func Set(err *gqlerror.Error, value string)

Set the error code on a given graphql error extension

Types

type ErrorKind

type ErrorKind int
const (
	// issues with graphql (validation, parsing).  422s in http, GQL_ERROR in websocket
	KindProtocol ErrorKind = iota
	// user errors, 200s in http, GQL_DATA in websocket
	KindUser
)

func GetErrorKind

func GetErrorKind(errs gqlerror.List) ErrorKind

get the kind of the first non User error, defaults to User if no errors have a custom extension

Jump to

Keyboard shortcuts

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