Documentation
¶
Index ¶
- Constants
- func ExtractConnectError(ctx context.Context, err error) error
- func ExtractToHTTPResponse(ctx context.Context, rw http.ResponseWriter, response *responseReceiver)
- func IsCode(err error, code Code) bool
- func NewConvertConnectErrorChiMiddleware() func(http.Handler) http.Handler
- func NewConvertConnectErrorInterceptor() connect.Interceptor
- func SetJSONError(ctx context.Context, err error)
- func SetJSONResponse(ctx context.Context, response any)
- func SetNewJSONError(ctx context.Context, code Code, msg string, err error)
- func WrapStorageDeleteError(target string, err error) error
- func WrapStorageReadError(target string, err error) error
- func WrapStorageWriteError(target string, err error) error
- type Code
- type Error
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) DataLoss = Code(15) Unauthenticated = Code(16) )
Variables ¶
This section is empty.
Functions ¶
func ExtractToHTTPResponse ¶
func ExtractToHTTPResponse(ctx context.Context, rw http.ResponseWriter, response *responseReceiver)
func NewConvertConnectErrorInterceptor ¶
func NewConvertConnectErrorInterceptor() connect.Interceptor
func SetJSONError ¶
func SetJSONResponse ¶
func WrapStorageDeleteError ¶
func WrapStorageReadError ¶
func WrapStorageWriteError ¶
Types ¶
type Error ¶
type Error struct {
Code Code
Msg string // ユーザーへ Code とともに返却するメッセージ
Err error // ログに残したいエラー
Stack string // スタックトレース
Details []proto.Message // ユーザーへ返却したい詳細なエラー
}
func NewErrorWithDetails ¶
func (*Error) AddDetailError ¶
func (*Error) AddDetailMessage ¶
func (*Error) AddDetailMessageWithCode ¶
func (*Error) ConnectError ¶
Click to show internal directories.
Click to hide internal directories.