status

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ClientClosed is non-standard http status code,
	// which defined by nginx.
	// https://httpstatus.in/499/
	ClientClosed = 499
)

Variables

View Source
var File_coder_status_proto protoreflect.FileDescriptor

Functions

func FromGRPCCode

func FromGRPCCode(code gcodes.Code) int

FromGRPCCode converts a gRPC error code into the corresponding HTTP response status.

func ToGRPCCode

func ToGRPCCode(code int) gcodes.Code

ToGRPCCode converts an HTTP error code into the corresponding gRPC response status.

Types

type Converter

type Converter interface {
	// ToGRPCCode converts an HTTP error code into the corresponding gRPC response status.
	ToGRPCCode(code int) gcodes.Code

	// FromGRPCCode converts a gRPC error code into the corresponding HTTP response status.
	FromGRPCCode(code gcodes.Code) int
}

Converter is a status converter.

var DefaultConverter Converter = statusConverter{}

DefaultConverter default converter.

type Status

type Status struct {

	// 业务错误码
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// 拓展信息
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Status) Descriptor deprecated

func (*Status) Descriptor() ([]byte, []int)

Deprecated: Use Status.ProtoReflect.Descriptor instead.

func (*Status) GetCode

func (x *Status) GetCode() int32

func (*Status) GetMetadata

func (x *Status) GetMetadata() map[string]string

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) ProtoReflect

func (x *Status) ProtoReflect() protoreflect.Message

func (*Status) Reset

func (x *Status) Reset()

func (*Status) String

func (x *Status) String() string

Jump to

Keyboard shortcuts

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