errcoder

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package errcoder implements `github.com/marmotedu/errors` Coder interface.

errcoder only allowed the following http status: StatusOK = 200 // RFC 7231, 6.3.1 StatusBadRequest = 400 // RFC 7231, 6.5.1 StatusUnauthorized = 401 // RFC 7235, 3.1 StatusForbidden = 403 // RFC 7231, 6.5.3 StatusNotFound = 404 // RFC 7231, 6.5.4 StatusInternalServerError = 500 // RFC 7231, 6.6.1

Index

Constants

This section is empty.

Variables

View Source
var ValidHTTPStatus = []int{200, 400, 401, 403, 404, 500}

Functions

func Register

func Register(code int, httpStatus int, message string)

Types

type ErrCoder

type ErrCoder struct {
	// contains filtered or unexported fields
}

ErrCoder implements `github.com/marmotedu/errors` Coder interface.

func (ErrCoder) Code

func (coder ErrCoder) Code() int

Code returns the integer error code.

func (ErrCoder) HTTPStatus

func (coder ErrCoder) HTTPStatus() int

HTTPStatus returns the associated HTTP status code.

func (ErrCoder) Reference

func (coder ErrCoder) Reference() string

Reference returns the reference document.

func (ErrCoder) String

func (coder ErrCoder) String() string

String implements stringer.

Jump to

Keyboard shortcuts

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