The ability, item, and move commands handle API call errors inconsistently:
- ability.go: Returns
err.Error(), err directly, bypassing the output builder
- item.go: Uses
os.Getenv("GO_TESTING") check and os.Exit(1), returns err.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) for item.go errors
- 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
}
The
ability,item, andmovecommands handle API call errors inconsistently:err.Error(), errdirectly, bypassing the output builderos.Getenv("GO_TESTING")check andos.Exit(1), returnserr.Error(), nil(incorrect - nil error signals success)output.String(), errThis inconsistency causes:
HandleCommandOutput0(success) instead of 1 (failure) foritem.goerrorsStandardize all three commands to use the
move.gopattern: