statuscodes

package
v1.62.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package statuscodes provides custom status types and helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StatusCategory

type StatusCategory int
const (
	CategoryOK          StatusCategory = 1
	CategoryClientError StatusCategory = 2
	CategoryServerError StatusCategory = 3
)

func (StatusCategory) String

func (i StatusCategory) String() string

type StatusCode

type StatusCode int
const (
	OK StatusCode = 600

	// Client-caused error responses
	BadRequest   StatusCode = 700
	Unauthorized StatusCode = 701
	Forbidden    StatusCode = 702
	NotFound     StatusCode = 703
	Conflict     StatusCode = 704
	RateLimited  StatusCode = 705

	// Server-caused error responses
	InternalServerError StatusCode = 800
	NotImplemented      StatusCode = 801
	Unavailable         StatusCode = 802
	UnknownError        StatusCode = 803
)

1. Keep OK not as zero so you know someone affirmatively picked it 2. Don't overlap with HTTP error codes so people know that these are different

func FromString added in v1.12.0

func FromString(s string) (StatusCode, bool)

func (StatusCode) Category

func (re StatusCode) Category() StatusCategory

func (StatusCode) String

func (i StatusCode) String() string

func (*StatusCode) UnmarshalText added in v1.12.0

func (re *StatusCode) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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