summaryrefslogtreecommitdiff
path: root/golang/pkg/agent/contracting.go
diff options
context:
space:
mode:
authorJulien Dessaux2025-02-17 00:40:43 +0100
committerJulien Dessaux2025-02-17 00:40:43 +0100
commitbd2fb50c819c2b180758308ef3751e7ea73e6ab7 (patch)
tree19632f7098691a1147357039a5efedf7c40a8d53 /golang/pkg/agent/contracting.go
parent[golang] handle paginated requests (diff)
downloadspacetraders-bd2fb50c819c2b180758308ef3751e7ea73e6ab7.tar.gz
spacetraders-bd2fb50c819c2b180758308ef3751e7ea73e6ab7.tar.bz2
spacetraders-bd2fb50c819c2b180758308ef3751e7ea73e6ab7.zip
[golang] implement shipyards visits
Diffstat (limited to 'golang/pkg/agent/contracting.go')
-rw-r--r--golang/pkg/agent/contracting.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/golang/pkg/agent/contracting.go b/golang/pkg/agent/contracting.go
index 0f07170..a3eb7aa 100644
--- a/golang/pkg/agent/contracting.go
+++ b/golang/pkg/agent/contracting.go
@@ -11,7 +11,7 @@ func (a *agent) autoContracting(ship *model.Ship) {
defer a.wg.Done()
contracts, err := a.client.MyContracts()
if err != nil {
- a.sendShipError(fmt.Errorf("failed to get my contracts: %w", err), ship)
+ a.channel <- fmt.Errorf("failed to get my contracts with ship %s: %w", ship.Symbol, err)
return
}
for _, contract := range contracts {
@@ -21,12 +21,12 @@ func (a *agent) autoContracting(ship *model.Ship) {
now := time.Now()
if now.Before(contract.Terms.Deadline) {
if err := a.runContract(&contract, ship); err != nil {
- a.sendShipError(fmt.Errorf("failed to run contracts: %w", err), ship)
+ a.channel <- fmt.Errorf("failed to run contracts with ship %s: %w", ship.Symbol, err)
return
}
}
}
- a.sendShipError(fmt.Errorf("failed to run contracts: negotiating new contracts is not implemented yet"), ship)
+ a.channel <- fmt.Errorf("failed to run contracts: negotiating new contracts is not implemented yet")
// TODO
//for {
// negotiate