feat: add OperationFailedError with actionable hints
The Kanboard API returns only true/false for many operations without explaining why they failed. Added OperationFailedError type that includes operation details and hints about possible causes. Updated MoveTaskPosition and MoveTaskToProject to use this new error type, providing users with actionable debugging information instead of generic "failed to move task" messages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
508c3ac6d2
commit
449cd2626c
6 changed files with 131 additions and 5 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -639,6 +640,20 @@ func TestClient_MoveTaskPosition_Failure(t *testing.T) {
|
|||
if err == nil {
|
||||
t.Fatal("expected error for failed move")
|
||||
}
|
||||
|
||||
// Verify it's an OperationFailedError with helpful hints
|
||||
if !IsOperationFailed(err) {
|
||||
t.Errorf("expected OperationFailedError, got %T", err)
|
||||
}
|
||||
|
||||
// Error message should contain actionable hints
|
||||
errMsg := err.Error()
|
||||
if !strings.Contains(errMsg, "moveTaskPosition") {
|
||||
t.Error("error should mention operation name")
|
||||
}
|
||||
if !strings.Contains(errMsg, "possible causes") {
|
||||
t.Error("error should include possible causes")
|
||||
}
|
||||
}
|
||||
|
||||
func TestClient_MoveTaskToProject(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue