errors

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2014 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Utility functions for producing errorneous http responses

Index

Constants

View Source
const (
	StatusTooManyRequests = 429
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	Format(ProxyError) (statusCode int, body []byte, contentType string)
}

type HttpError

type HttpError struct {
	StatusCode int
	Body       string
}

func FromStatus

func FromStatus(statusCode int) *HttpError

func (*HttpError) Error

func (r *HttpError) Error() string

func (*HttpError) GetStatusCode

func (r *HttpError) GetStatusCode() int

func (*HttpError) Headers

func (r *HttpError) Headers() http.Header

type JsonFormatter

type JsonFormatter struct {
}

func (*JsonFormatter) Format

func (f *JsonFormatter) Format(err ProxyError) (int, []byte, string)

type ProxyError

type ProxyError interface {
	GetStatusCode() int
	Error() string
	Headers() http.Header
}

type RedirectError

type RedirectError struct {
	URL *url.URL
}

func (*RedirectError) Error

func (r *RedirectError) Error() string

func (*RedirectError) GetStatusCode

func (r *RedirectError) GetStatusCode() int

func (*RedirectError) Headers

func (r *RedirectError) Headers() http.Header

Jump to

Keyboard shortcuts

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