cerr

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK                 = Code(0)
	Canceled           = Code(1)
	Unknown            = Code(2)
	InvalidArgument    = Code(3)
	DeadlineExceeded   = Code(4)
	NotFound           = Code(5)
	AlreadyExists      = Code(6)
	PermissionDenied   = Code(7)
	ResourceExhausted  = Code(8)
	FailedPrecondition = Code(9)
	Aborted            = Code(10)
	OutOfRange         = Code(11)
	Unimplemented      = Code(12)
	Internal           = Code(13)
	Unavailable        = Code(14)
	DataLoss           = Code(15)
	Unauthenticated    = Code(16)
)

Variables

This section is empty.

Functions

func ExtractConnectError

func ExtractConnectError(ctx context.Context, err error) error

func ExtractToHTTPResponse

func ExtractToHTTPResponse(ctx context.Context, rw http.ResponseWriter, response *responseReceiver)

func IsCode

func IsCode(err error, code Code) bool

func NewConvertConnectErrorChiMiddleware

func NewConvertConnectErrorChiMiddleware() func(http.Handler) http.Handler

func NewConvertConnectErrorInterceptor

func NewConvertConnectErrorInterceptor() connect.Interceptor

func SetJSONError

func SetJSONError(ctx context.Context, err error)

func SetJSONResponse

func SetJSONResponse(ctx context.Context, response any)

func SetNewJSONError

func SetNewJSONError(ctx context.Context, code Code, msg string, err error)

func WrapStorageDeleteError

func WrapStorageDeleteError(target string, err error) error

func WrapStorageReadError

func WrapStorageReadError(target string, err error) error

func WrapStorageWriteError

func WrapStorageWriteError(target string, err error) error

Types

type Code

type Code int

func NewCodeFromConnectError

func NewCodeFromConnectError(err error) Code

func (Code) ConnectCode

func (c Code) ConnectCode() connect.Code

func (Code) HTTPCode

func (c Code) HTTPCode() int

func (Code) String

func (i Code) String() string

type Error

type Error struct {
	Code    Code
	Msg     string          // ユーザーへ Code とともに返却するメッセージ
	Err     error           // ログに残したいエラー
	Stack   string          // スタックトレース
	Details []proto.Message // ユーザーへ返却したい詳細なエラー
}

func NewError

func NewError(code Code, msg string, underlying error) *Error

func NewErrorWithDetails

func NewErrorWithDetails(code Code, msg string, underlying error, details []proto.Message) *Error

func (*Error) AddDetailError

func (e *Error) AddDetailError(err proto.Message)

func (*Error) AddDetailMessage

func (e *Error) AddDetailMessage(msg string) error

func (*Error) AddDetailMessageWithCode

func (e *Error) AddDetailMessageWithCode(msg string, code string) error

func (*Error) ConnectError

func (e *Error) ConnectError() *connect.Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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