{"modulePath":"github.com/dapr/kit","version":"v0.19.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Constants\n\n```go\nconst (\n\t// CodeNotFound Generic.\n\tCodeNotFound      = \"NOT_FOUND\"\n\tCodeNotConfigured = \"NOT_CONFIGURED\"\n\tCodeNotSupported  = \"NOT_SUPPORTED\"\n\tCodeIllegalKey    = \"ILLEGAL_KEY\"\n\n\t// CodePrefixStateStore is for StateStore components.\n\tCodePrefixStateStore         = \"DAPR_STATE_\"\n\tCodePrefixPubSub             = \"DAPR_PUBSUB_\"\n\tCodePrefixBindings           = \"DAPR_BINDING_\"\n\tCodePrefixSecretStore        = \"DAPR_SECRET_\" // #nosec G101\n\tCodePrefixConfigurationStore = \"DAPR_CONFIGURATION_\"\n\tCodePrefixLock               = \"DAPR_LOCK_\"\n\tCodePrefixNameResolution     = \"DAPR_NAME_RESOLUTION_\"\n\tCodePrefixMiddleware         = \"DAPR_MIDDLEWARE_\"\n\tCodePrefixCryptography       = \"DAPR_CRYPTOGRAPHY_\"\n\tCodePrefixPlacement          = \"DAPR_PLACEMENT_\"\n\n\t// CodePostfixGetStateFailed is for State.\n\tCodePostfixGetStateFailed      = \"GET_STATE_FAILED\"\n\tCodePostfixTooManyTransactions = \"TOO_MANY_TRANSACTIONS\"\n\tCodePostfixQueryFailed         = \"QUERY_FAILED\"\n)\n```\n\n```go\nconst (\n\tDomain = \"dapr.io\"\n)\n```\n\n## Types\n\n```go\ntype Error struct {\n\t// contains filtered or unexported fields\n}\n```\nError 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.\n\n```go\nfunc FromError(err error) (*Error, bool)\n```\nFromError takes in an error and returns back the kitError if it's that type under the hood\n\n```go\nfunc (e *Error) AddDetails(details ...proto.Message) *Error\n```\nAddDetails allows details to be mutable and added to the error in runtime\n\n```go\nfunc (e *Error) Category() string\n```\nCategory returns the error code's category\n\n```go\nfunc (e *Error) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *Error) ErrorCode() string\n```\nErrorCode returns the error code from the error, prioritizing the legacy Error.Tag, otherwise the ErrorInfo.Reason\n\n```go\nfunc (e *Error) GRPCStatus() *status.Status\n```\nGRPCStatus returns the gRPC status.Status object.\n\n```go\nfunc (e *Error) GrpcStatusCode() grpcCodes.Code\n```\nGrpcStatusCode gets the error grpc code\n\n```go\nfunc (e *Error) HTTPStatusCode() int\n```\nHTTPStatusCode gets the error http code\n\n```go\nfunc (e *Error) Is(targetI error) bool\n```\nIs implements the interface that checks if the error matches the given one.\n\n```go\nfunc (e *Error) JSONErrorValue() []byte\n```\nJSONErrorValue implements the errorResponseValue interface.\n\n```go\nfunc (e *Error) String() string\n```\nString returns the string representation.\n\n```go\ntype ErrorBuilder struct {\n\t// contains filtered or unexported fields\n}\n```\nErrorBuilder is used to build the error\n\n```go\nfunc NewBuilder(grpcCode grpcCodes.Code, httpCode int, message string, tag string, category string) *ErrorBuilder\n```\nNewBuilder create a new ErrorBuilder using the supplied required error fields\n\n```go\nfunc (b *ErrorBuilder) Build() error\n```\nBuild builds our error\n\n```go\nfunc (b *ErrorBuilder) WithDetails(details ...proto.Message) *ErrorBuilder\n```\nWithDetails is used to pass any error details to the Error struct.\n\n```go\nfunc (b *ErrorBuilder) WithErrorInfo(reason string, metadata map[string]string) *ErrorBuilder\n```\nWithErrorInfo adds error information to the Error struct.\n\n```go\nfunc (b *ErrorBuilder) WithFieldViolation(fieldName string, msg string) *ErrorBuilder\n```\nWithFieldViolation is used to pass FieldViolation error details to the Error struct.\n\n```go\nfunc (b *ErrorBuilder) WithHelp(links []*errdetails.Help_Link) *ErrorBuilder\n```\nWithHelp is used to pass Help error details to the Error struct.\n\n```go\nfunc (b *ErrorBuilder) WithHelpLink(url string, description string) *ErrorBuilder\n```\nWithHelpLink is used to pass HelpLink error details to the Error struct.\n\n```go\nfunc (b *ErrorBuilder) WithResourceInfo(resourceType string, resourceName string, owner string, description string) *ErrorBuilder\n```\nWithResourceInfo is used to pass ResourceInfo error details to the Error struct.\n\n","path":"github.com/dapr/kit/errors","name":"errors","synopsis":"","isRedistributable":true}
