errors

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_wrap_error_proto protoreflect.FileDescriptor
View Source
var New = func() *Error {
	return &Error{}
}

nil

Functions

func Equal added in v0.6.1

func Equal(err1 error, err2 error) bool

Types

type Error

type Error struct {
	Code   int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`    // http status code
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // http status text
	Name   string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`     // error name
	Msg    string `protobuf:"bytes,4,opt,name=msg,proto3" json:"msg,omitempty"`       // error msg
	// contains filtered or unexported fields
}

func FromError

func FromError(err error) *Error

func NewBadGateway added in v0.6.3

func NewBadGateway(name string, formatter string, args ...any) *Error

502 Bad Gateway

func NewBadRequest

func NewBadRequest(name string, formatter string, args ...any) *Error

400 Bad Request

func NewConflict

func NewConflict(name string, formatter string, args ...any) *Error

409 Conflict

func NewContinue

func NewContinue() *Error

100 Continue

func NewCreated

func NewCreated() *Error

201 Created

func NewForbidden

func NewForbidden(name string, formatter string, args ...any) *Error

403 Forbidden

func NewFound

func NewFound(name string, formatter string, args ...any) *Error

302 Found

func NewGatewayTimeout added in v0.6.3

func NewGatewayTimeout(name string, formatter string, args ...any) *Error

504 Gateway Timeout

func NewHTTPVersionNotSupported added in v0.6.3

func NewHTTPVersionNotSupported(name string, formatter string, args ...any) *Error

504 HTTP Version Not Supported

func NewInternalServerError

func NewInternalServerError(name string, formatter string, args ...any) *Error

500 Internal Server Error

func NewMethodNotAllowed

func NewMethodNotAllowed(name string, formatter string, args ...any) *Error

405 Method Not Allowed

func NewMovedPermanently

func NewMovedPermanently(name string, formatter string, args ...any) *Error

301 Moved Permanently

func NewMultipleChoices

func NewMultipleChoices(name string, formatter string, args ...any) *Error

300 Multiple Choices

func NewNoContent

func NewNoContent() *Error

204 No Content

func NewNotFound

func NewNotFound(name string, formatter string, args ...any) *Error

404 Not Found

func NewNotImplemented

func NewNotImplemented(name string, formatter string, args ...any) *Error

501 Not Implemented

func NewOK

func NewOK() *Error

200 OK

func NewRequestTimeout

func NewRequestTimeout(name string, formatter string, args ...any) *Error

408 Request Timeout

func NewServiceUnavailable

func NewServiceUnavailable(name string, formatter string, args ...any) *Error

503 Service Unavailable

func NewUnauthorized

func NewUnauthorized(name string, formatter string, args ...any) *Error

401 Unauthorized

func Parse

func Parse(err string) *Error

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) Error

func (e *Error) Error() string

func (*Error) GetCode

func (x *Error) GetCode() int32

func (*Error) GetMsg

func (x *Error) GetMsg() string

func (*Error) GetName

func (x *Error) GetName() string

func (*Error) GetStatus

func (x *Error) GetStatus() string

func (*Error) OK

func (e *Error) OK() bool

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

Jump to

Keyboard shortcuts

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