From cb27f33e57558212f4d4e9470ccb770a8d0c3c37 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 07:38:00 +0100 Subject: [PATCH] ax(mining): replace prose method comments with usage example in errors.go Seven MiningError method comments restated the function signature verbatim (AX principle 2 violation). Deleted all seven and replaced NewMiningError's comment with a concrete call-site example per the RFC rule: if a comment restates what the type signature already says, delete it. Co-Authored-By: Charon --- pkg/mining/errors.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pkg/mining/errors.go b/pkg/mining/errors.go index 96d5288..5a85939 100644 --- a/pkg/mining/errors.go +++ b/pkg/mining/errors.go @@ -38,7 +38,6 @@ type MiningError struct { Cause error // Underlying error } -// Error implements the error interface func (e *MiningError) Error() string { if e.Cause != nil { return fmt.Sprintf("%s: %s (%v)", e.Code, e.Message, e.Cause) @@ -46,35 +45,29 @@ func (e *MiningError) Error() string { return fmt.Sprintf("%s: %s", e.Code, e.Message) } -// Unwrap returns the underlying error func (e *MiningError) Unwrap() error { return e.Cause } -// WithCause adds an underlying error func (e *MiningError) WithCause(err error) *MiningError { e.Cause = err return e } -// WithDetails adds technical details func (e *MiningError) WithDetails(details string) *MiningError { e.Details = details return e } -// WithSuggestion adds a suggestion for the user func (e *MiningError) WithSuggestion(suggestion string) *MiningError { e.Suggestion = suggestion return e } -// IsRetryable returns whether the error is retryable func (e *MiningError) IsRetryable() bool { return e.Retryable } -// StatusCode returns the HTTP status code for this error func (e *MiningError) StatusCode() int { if e.HTTPStatus == 0 { return http.StatusInternalServerError @@ -82,7 +75,7 @@ func (e *MiningError) StatusCode() int { return e.HTTPStatus } -// NewMiningError creates a new MiningError +// NewMiningError("START_FAILED", "failed to start xmrig").WithCause(err) func NewMiningError(code, message string) *MiningError { return &MiningError{ Code: code,