-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
refactorRefactoring existing code.Refactoring existing code.
Description
The ability, item, and move commands handle API call errors inconsistently:
- ability.go: Returns
err.Error(), errdirectly, bypassing the output builder - item.go: Uses
os.Getenv("GO_TESTING")check andos.Exit(1), returnserr.Error(), nil(incorrect - nil error signals success)- This was left over from a previous version when trying to make tests pass.
- move.go: Correctly writes error to output builder and returns
output.String(), err
This inconsistency causes:
- Errors not properly detected by
HandleCommandOutput - Error messages printed to stdout instead of stderr
- Exit code
0(success) instead of 1 (failure) foritem.goerrors - Test-specific code pollution
Standardize all three commands to use the move.go pattern:
xxxStruct, xxxName, err := connections.XxxApiCall(endpoint, xxxName, connections.APIURL)
if err != nil {
output.WriteString(err.Error())
return output.String(), err
}Metadata
Metadata
Assignees
Labels
refactorRefactoring existing code.Refactoring existing code.