Documentation
¶
Overview ¶
Package failures provides the shared structured error boundary used by Codefly plugins, hosts, Mind/editor integrations, and automation.
Index ¶
- func Clone(failure *basev0.Failure) *basev0.Failure
- func Ensure(existing *basev0.Failure, code basev0.FailureCode, operation, message string) *basev0.Failure
- func Extract(err error) (*basev0.Failure, bool)
- func ForOutcome(success bool, existing *basev0.Failure, code basev0.FailureCode, ...) *basev0.Failure
- func FromError(operation string, err error) *basev0.Failure
- func FromFailure(failure *basev0.Failure, presentation string, cause error) error
- func GRPC(failure *basev0.Failure) error
- func New(code basev0.FailureCode, operation, message string) *basev0.Failure
- func Wrap(code basev0.FailureCode, operation, message string, cause error) error
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
Clone returns an independent copy suitable for forwarding across another response boundary.
func Ensure ¶
func Ensure(existing *basev0.Failure, code basev0.FailureCode, operation, message string) *basev0.Failure
Ensure forwards an existing failure or creates the specified fallback when a producer violated the structured-failure contract.
func ForOutcome ¶
func ForOutcome(success bool, existing *basev0.Failure, code basev0.FailureCode, operation, message string) *basev0.Failure
ForOutcome returns nil for success and an ensured failure for an unsuccessful result.
func FromFailure ¶
FromFailure converts an existing generated detail into an ordinary Go error without dropping diagnostics, resource identity, process evidence, or causes. presentation is only the local Error() text; the protobuf remains unchanged for downstream extraction.
func GRPC ¶
GRPC returns a google.rpc.Status-compatible gRPC error carrying Failure as a typed detail. Callers can use Extract without parsing the status message.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error carries a typed Failure through ordinary Go error chains. Plugin code can classify a native/toolchain/domain error once; response helpers and gRPC boundaries recover the same generated protobuf without parsing strings.
func (*Error) CodeflyFailure ¶
CodeflyFailure exposes the generated detail to FromError.