apierrors

package
v0.0.0-...-ed9fe1d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BadRequest = &Error{
		Code:    "bad_request",
		Message: "we cannot process your request",
		Status:  response.HTTPStatusForbidden,
	}
	Forbidden = &Error{
		Code:    "forbidden",
		Message: "you do not have an access to the resource",
		Status:  response.HTTPStatusForbidden,
	}
	NotFound = &Error{
		Code:    "not_found",
		Message: "the requested resource is not found on the server",
		Status:  response.HTTPStatusNotFound,
	}
	ServerError = &Error{
		Code:    "internal_server_error",
		Message: "unexpected server error occurred. please try again later.",
		Status:  response.HTTPStatusInternalServerError,
	}
)

General API errors

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    string              `json:"code"`
	Message string              `json:"message"`
	Status  response.HTTPStatus `json:"-"`
}

Error represents API error

func (*Error) ToResponse

func (err *Error) ToResponse() *response.Response

ToResponse returns *response.Response object for this error

Jump to

Keyboard shortcuts

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