ax(mining): remove banned errors import from errors_test.go
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled

Replace errors.New() with ErrInternal()/ErrTimeout() and errors.Unwrap(err)
with err.Unwrap() — the MiningError type provides both without the banned import.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 14:10:49 +01:00
parent fc7a1a2147
commit 71292ccdc8
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -1,7 +1,6 @@
package mining
import (
"errors"
"net/http"
"testing"
)
@ -17,14 +16,14 @@ func TestErrors_Error_Good(t *testing.T) {
// TestErrors_Error_Bad verifies the error string includes the underlying cause
func TestErrors_Error_Bad(t *testing.T) {
cause := errors.New("underlying error")
cause := ErrInternal("underlying error")
err := NewMiningError(ErrCodeStartFailed, "failed to start").WithCause(cause)
if err.Cause != cause {
t.Error("Cause was not set")
}
if errors.Unwrap(err) != cause {
if err.Unwrap() != cause {
t.Error("Unwrap did not return cause")
}
}
@ -136,7 +135,7 @@ func TestErrors_PredefinedErrors_Good(t *testing.T) {
// TestErrors_Chaining_Ugly verifies error chaining survives multiple WithCause/WithDetails/WithSuggestion calls
func TestErrors_Chaining_Ugly(t *testing.T) {
cause := errors.New("network timeout")
cause := ErrTimeout("network timeout")
err := ErrConnectionFailed("pool:3333").
WithCause(cause).
WithDetails("timeout after 30s").