Documentation
¶
Index ¶
- func Cause(err error) (error, bool)
- func GetPrintableMessage(err error) string
- func HandleFatalError(err error)
- func Marshal(err error) *proto.Error
- func New(f string, args ...interface{}) error
- func NewFriendlyError(f string, args ...interface{}) error
- func RootCause(err error) error
- func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, ...) error
- func UnaryServerInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, ...) (interface{}, error)
- func Unmarshal(grpcErr error, protoErr *proto.Error) error
- func WithContext(context string, err error) error
- type ContextError
- type FriendlyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPrintableMessage ¶
GetPrintableMessage returns a user friendly error to print to the user. If any error in the error chain has a user friendly error message, it prints that. Otherwise, it prints the errors' generic message.
func HandleFatalError ¶
func HandleFatalError(err error)
func Marshal ¶
Marshal converts an error (that may contain custom Kelda error types) into an error that can be transmitted over gRPC, and unmarshalled on the other side.
func New ¶
New returns a new Go error. It is provided so that callers don't have to import both the Go "errors" package and this package.
func NewFriendlyError ¶
NewFriendlyError returns a new user friendly error that can be retrieved by GetPrintableMessage.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
func Unmarshal ¶
Unmarshal reconstructs an error created by Marshal. It also takes the error returned by gRPC for easy handling in client logic.
func WithContext ¶
WithContext returns an error that can be unwrapped by `Cause`.
Types ¶
type ContextError ¶
ContextError is an error that has information on what caused it.
type FriendlyError ¶
A FriendlyError is an error with that can be directly printed to the user without any other context.