Documentation ¶
Index ¶
- Constants
- Variables
- func IsError(err error) bool
- type Error
- func BadRequest(code int32, reason, message string) Error
- func BadRequestCause(code int32, reason, message string, err error) Error
- func Forbidden(code int32, reason, message string) Error
- func ForbiddenCause(code int32, reason, message string, err error) Error
- func FromError(code, status int32, reason, message string, err error) Error
- func FromErrorf(code, status int32, reason string, err error, format string, ...) Error
- func InternalServer(code int32, reason, message string) Error
- func InternalServerCause(code int32, reason, message string, err error) Error
- func New(code, status int32, reason, message string) Error
- func Newf(code, status int32, reason, format string, args ...interface{}) Error
- func NotFound(code int32, reason, message string) Error
- func NotFoundCause(code int32, reason, message string, err error) Error
- func ServiceUnavailable(code int32, reason, message string) Error
- func ServiceUnavailableCause(code int32, reason, message string, err error) Error
- func Unauthorized(code int32, reason, message string) Error
- func UnauthorizedCause(code int32, reason, message string, err error) Error
- type ErrorImpl
Constants ¶
View Source
const ( UnknownCode = -1 UnknownReason = "UnknownError" UnknownMessage = "unknown error" DefaultStatus = http.StatusInternalServerError )
Variables ¶
View Source
var ( // optional int32 code = 1109; E_Code = &file_third_party_errors_errors_proto_extTypes[1] // optional string desc = 1110; E_Desc = &file_third_party_errors_errors_proto_extTypes[2] )
Extension fields to descriptorpb.EnumValueOptions.
View Source
var (
// optional int32 default_code = 1108;
E_DefaultCode = &file_third_party_errors_errors_proto_extTypes[0]
)
Extension fields to descriptorpb.EnumOptions.
View Source
var File_third_party_errors_errors_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Error ¶
type Error interface { error Code() int32 HttpStatus() int32 Reason() string Message() string Metadata() map[string]string Unwrap() error }
func BadRequest ¶
func FromErrorf ¶
func InternalServer ¶
func InternalServerCause ¶
func ServiceUnavailable ¶
func ServiceUnavailableCause ¶
func Unauthorized ¶
Click to show internal directories.
Click to hide internal directories.