errors

package
v0.0.0-...-2262de7 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: NCSA Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAppHandlerAlreadyAdded = errors.New("application handler has already been added")
View Source
var ErrExtensionNotFound = errors.NewError("required extesnion dependency not found")

ErrExtensionNotFound is returned when a request is made to the ExtensionManager to load an extension whose dependencies cannot be fulfilled.

View Source
var ErrIncompleteWrite = errors.NewError("data not completely written to client")

ErrIncompleteWrite is returned whenever an error condition has been encountered where the response was not written in its entirety to the client.

View Source
var ErrInvalidContentType = errors.NewError("invalid content type")

ErrInvalidContentType is returned in cases where an invalid content-type header was received by the client and the application or server has refused to handle it. This may be due to an implementation-speicfic failure to handle a particular content-type or may be used by implementers who wish to reject certain content-types at the controller level.

View Source
var ErrInvalidHost = errors.NewError("invalid host or host name provided")

ErrInvalidHost is returned if an invalid host or host name is supplied to Capstan. Presently, this is returned by the URLBuilder if the configured host name cannot be parsed.

View Source
var ErrInvalidInterface = errors.NewError("invalid interface: method not supported")

ErrInvalidInterface is returned, typically, if an interface type conversion has failed.

View Source
var ErrInvalidParam = errors.NewError("invalid parameter type or value")

ErrInvalidParam is returned by the Context when a typed parameter is requested that does not exist or if its value could not be cast to the requested type.

View Source
var ErrInvalidPath = errors.NewError("invalid path")

ErrInvalidPath is returned by template interfaces that interact with the file system, such as the TemplateReader. Other interfaces may also return this error when a path is considered invalid. At present, this may typically be due to empty path names.

View Source
var ErrInvalidPattern = errors.NewError("invalid pattern")

ErrInvalidPattern is returned by readers or templaters that accept matching patterns for acceptable files for parsing. If no pattern is provided or the pattern is invalid, this error will be returned.

View Source
var ErrJSONDecoding = errors.NewError("error decoding JSON")

ErrJSONDecoding is returned whenever JSON input cannot be decoded.

View Source
var ErrMissingParam = errors.NewError("missing parameter")

ErrMissingParam is returned by the URLMapper/URLBuilder if a required parameter was not provided a value.

View Source
var ErrNilDependency = errors.NewError("attempt to assign nil dependency to struct field (ErrOnNil: true)")
View Source
var ErrNoHostname = errors.NewError("no hostname configured")

ErrNoHostname is returned if the server expects the caller to have configured a hostname but one was not provided.

View Source
var ErrNoPortsFound = errors.NewError("no ports found")

ErrNoPortsFound is returned if the free port scanner is unable to find a free port.

View Source
var ErrNoRendererConfigured = errors.NewError("no renderer configured")

ErrNoRendererConfigured is returned whenever context.Renderer or context.Render is called when no renderer has been configured.

View Source
var ErrNotJSON = errors.NewError("request does not contain a valid content-type header for JSON input")

ErrNotJSON is returned whenever decoded JSON is requested from the Context on a request that does not contain a valid content type or if the JSON decoding process fails.

View Source
var ErrNotMaster = errors.NewError("not master server")

ErrNotMaster is returned if a method is called on a server instance that is not the master. This will be the case, for example, on subservers in which Listen() has been called.

View Source
var ErrPathNotFound = errors.NewError("path not found")

ErrPathNotFound is returned by template interfaces that interact with the file system whenever a path is requested that does not exist.

View Source
var ErrReadingTemplate = errors.NewError("error reading template")

ErrReadingTemplate is returned whenever a template file cannot be read or if the template backend is unable to read the template source. Backends should return this whenever the read fails.

View Source
var ErrTemplateValue = errors.NewError("invalid value passed to Render()")

ErrTemplateValue is returned if the value passed to Render() on a given template cannot be cast to the data type expected by the template backend.

Functions

func Consume

func Consume(v interface{}, err error) interface{}

Consume and ignore the error argument. This may be used as a temporary means of silently dropping error values.

Use this function with care. Errors are almost always returned for a reason and indicate a condition that should not be ignored. Usage of this function is recommended only when you fully understand all possible error conditions returned by a call and whether they can be safely ignored.

func Must

func Must(v interface{}, err error) interface{}

Types

type Internal

type Internal struct {
	Controller string
	Params     url.Values
	// contains filtered or unexported fields
}

Internal contains metadata to redirect processing to a different controller. Such a redirect occurs internally (hence the name) and does not return to the remote client until the controller processing has finished.

Controller may be the automatically generated controller name, a manually-configured name, and may include the request method.

Note: This will not work for unnamed routes.

func (Internal) Error

func (i Internal) Error() string

func (Internal) IfNot

func (i Internal) IfNot(exclude string) *Internal

func (Internal) Redirect

func (i Internal) Redirect(controller string) bool

type Redirect

type Redirect struct {
	URL  string
	Code int
	// contains filtered or unexported fields
}

Redirect contains metadata associated with an HTTP redirect (default 301) that, when returned from a controller, will interrupt further processing and redirect the client to `URL`.

func (Redirect) Error

func (r Redirect) Error() string

func (Redirect) Redirect

func (r Redirect) Redirect(url string) bool

type Redirector

type Redirector interface {
	Redirect(string) bool
}

Jump to

Keyboard shortcuts

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