Documentation ¶
Index ¶
- Constants
- type Error
- func (e *Error) AddDetails(details ...proto.Message) *Error
- func (e Error) Error() string
- func (e Error) GRPCStatus() *status.Status
- func (e *Error) GrpcStatusCode() grpcCodes.Code
- func (e *Error) HTTPStatusCode() int
- func (e *Error) Is(targetI error) bool
- func (e Error) JSONErrorValue() []byte
- func (e Error) String() string
- type ErrorBuilder
- func (b *ErrorBuilder) Build() error
- func (b *ErrorBuilder) WithDetails(details ...proto.Message) *ErrorBuilder
- func (b *ErrorBuilder) WithErrorInfo(reason string, metadata map[string]string) *ErrorBuilder
- func (b *ErrorBuilder) WithFieldViolation(fieldName string, msg string) *ErrorBuilder
- func (b *ErrorBuilder) WithHelp(links []*errdetails.Help_Link) *ErrorBuilder
- func (b *ErrorBuilder) WithHelpLink(url string, description string) *ErrorBuilder
- func (b *ErrorBuilder) WithResourceInfo(resourceType string, resourceName string, owner string, description string) *ErrorBuilder
Constants ¶
const ( // Generic CodeNotFound = "NOT_FOUND" CodeNotConfigured = "NOT_CONFIGURED" CodeNotSupported = "NOT_SUPPORTED" CodeIllegalKey = "ILLEGAL_KEY" // Components CodePrefixStateStore = "DAPR_STATE_" CodePrefixPubSub = "DAPR_PUBSUB_" CodePrefixBindings = "DAPR_BINDING_" CodePrefixSecretStore = "DAPR_SECRET_" CodePrefixConfigurationStore = "DAPR_CONFIGURATION_" CodePrefixLock = "DAPR_LOCK_" CodePrefixNameResolution = "DAPR_NAME_RESOLUTION_" CodePrefixMiddleware = "DAPR_MIDDLEWARE_" // State CodePostfixGetStateFailed = "GET_STATE_FAILED" CodePostfixTooManyTransactions = "TOO_MANY_TRANSACTIONS" CodePostfixQueryFailed = "QUERY_FAILED" )
const (
Domain = "dapr.io"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error implements the Error interface and the interface that complies with "google.golang.org/grpc/status".FromError(). It can be used to send errors to HTTP and gRPC servers, indicating the correct status code for each.
func FromError ¶
FromError takes in an error and returns back the kitError if it's that type under the hood
func (*Error) AddDetails ¶
Allow details to be mutable and added to the error in runtime
func (Error) GRPCStatus ¶
GRPCStatus returns the gRPC status.Status object.
func (*Error) GrpcStatusCode ¶
GrpcStatusCode gets the error grpc code
func (*Error) HTTPStatusCode ¶
HTTPStatusCode gets the error http code
func (Error) JSONErrorValue ¶
JSONErrorValue implements the errorResponseValue interface.
type ErrorBuilder ¶
type ErrorBuilder struct {
// contains filtered or unexported fields
}
ErrorBuilder is used to build the error
func NewBuilder ¶
NewBuilder create a new ErrorBuilder using the supplied required error fields
func (*ErrorBuilder) WithDetails ¶
func (b *ErrorBuilder) WithDetails(details ...proto.Message) *ErrorBuilder
WithDetails is used to pass any error details to the Error struct.
func (*ErrorBuilder) WithErrorInfo ¶
func (b *ErrorBuilder) WithErrorInfo(reason string, metadata map[string]string) *ErrorBuilder
WithErrorInfo adds error information to the Error struct.
func (*ErrorBuilder) WithFieldViolation ¶
func (b *ErrorBuilder) WithFieldViolation(fieldName string, msg string) *ErrorBuilder
WithFieldViolation is used to pass FieldViolation error details to the Error struct.
func (*ErrorBuilder) WithHelp ¶
func (b *ErrorBuilder) WithHelp(links []*errdetails.Help_Link) *ErrorBuilder
WithHelp is used to pass Help error details to the Error struct.
func (*ErrorBuilder) WithHelpLink ¶
func (b *ErrorBuilder) WithHelpLink(url string, description string) *ErrorBuilder
WithHelpLink is used to pass HelpLink error details to the Error struct.
func (*ErrorBuilder) WithResourceInfo ¶
func (b *ErrorBuilder) WithResourceInfo(resourceType string, resourceName string, owner string, description string) *ErrorBuilder
WithResourceInfo is used to pass ResourceInfo error details to the Error struct.