server

package
v0.3.1-0...-ca91996 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 4 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRequest

type BadRequest struct {
	Message string
	// usually nil, but may be used to transport an error that has occurred while
	// trying to interpret parameter data.
	Inner error
}

BadRequest is an error resulting from getting a request whose parameters are generally or in the current state invalid.

func (*BadRequest) Error

func (br *BadRequest) Error() string

func (BadRequest) StatusCode

func (BadRequest) StatusCode() int

StatusCode returns 400

type Context

type Context interface {
	resources.Provider
	ActiveGroup() groups.Group
}

Context gives access to data available in the server thread. This is a read-only view of data required for serialization and state initialization.

Details on Fonts and Heroes are available in the display thread via render.Context.

type Error

type Error interface {
	error
	StatusCode() int
}

Error is an error that can be sent as HTTP response.

This is used as error type on funcs that are invoked as part of handling an HTTP request.

type InternalError

type InternalError struct {
	// may be empty; if not, describes the circumstances in which the error was
	// encountered.
	Description string
	// may be nil; if not, describes the error that has occurred
	Inner error
}

InternalError describes an unexpected internal error. This should be used for problems with external systems (e.g. file system).

func (*InternalError) Error

func (ie *InternalError) Error() string

func (InternalError) StatusCode

func (InternalError) StatusCode() int

StatusCode returns 500

type Loader

type Loader interface {
	// Load invalidates the Loader's state and replaces it with the given YAML
	// data.
	//
	// If the YAML data is invalid, an error is returned and the Loader's previous
	// state must be preserved.
	Load(node *yaml.Node, ctx Context) error
}

Loader describes an object whose state can be loaded from YAML data.

type MessageSender

type MessageSender interface {
	Warning(text string)
	Error(text string)
}

MessageSender is used to send warnings and errors issued at startup to the client to be shown on the main page.

type NotFound

type NotFound struct {
	Name string
}

NotFound is an error resulting from referencing an unknown ID either in the URL or in parameters.

func (*NotFound) Error

func (nf *NotFound) Error() string

func (NotFound) StatusCode

func (NotFound) StatusCode() int

StatusCode returns 404

type Persister

type Persister interface {
	// Persist returns a view of the data that can be written to persistent
	// storage in YAML format, possibly as part of a larger structure.
	//
	// If you need to manually serialize the structure, return a *yaml.Node.
	// Generally, if the returned value implements yaml.Marshaler, that will be
	// used for serialization.
	Persist(ctx Context) interface{}
}

Persister describes an object whose state can be persisted into a YAML stream.

Jump to

Keyboard shortcuts

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