summaryrefslogtreecommitdiff
path: root/lib/ships.js
diff options
context:
space:
mode:
authorJulien Dessaux2023-06-14 00:07:44 +0200
committerJulien Dessaux2023-06-14 00:07:44 +0200
commitec5d09586feb2e0cd4177fb9ed0cc711f9dd6963 (patch)
tree64132d3b7052ca743e23235f5e2b4a37771c04d3 /lib/ships.js
parentFixed error handling after network code rework (diff)
downloadspacetraders-ec5d09586feb2e0cd4177fb9ed0cc711f9dd6963.tar.gz
spacetraders-ec5d09586feb2e0cd4177fb9ed0cc711f9dd6963.tar.bz2
spacetraders-ec5d09586feb2e0cd4177fb9ed0cc711f9dd6963.zip
Fixed api errors and some async issues
Diffstat (limited to '')
-rw-r--r--lib/ships.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ships.js b/lib/ships.js
index 1e92cf3..12cbd7d 100644
--- a/lib/ships.js
+++ b/lib/ships.js
@@ -15,7 +15,7 @@ export async function extract(ctx) {
switch(response.error.code) {
case 4000: // ship is on cooldown
await api.sleep(response.error.data.cooldown.remainingSeconds * 1000);
- return extract(ctx);
+ return await extract(ctx);
case 4228: // ship is full
return null;
default: // yet unhandled error
@@ -38,7 +38,7 @@ export async function dock(ctx) {
switch(response.error.code) {
case 4214: // ship is in transit
await api.sleep(response.error.data.secondsToArrival * 1000);
- return dock(ctx);
+ return await dock(ctx);
default: // yet unhandled error
throw response;
}
@@ -66,7 +66,7 @@ export async function navigate(ctx) {
switch(response.error.code) {
case 4214: // ship is in transit
await api.sleep(response.error.data.secondsToArrival * 1000);
- return navigate(ctx);
+ return await navigate(ctx);
default: // yet unhandled error
throw response;
}
@@ -96,7 +96,7 @@ export async function orbit(ctx) {
switch(response.error.code) {
case 4214: // ship is in transit
await api.sleep(response.error.data.secondsToArrival * 1000);
- return orbit(ctx);
+ return await orbit(ctx);
default: // yet unhandled error
throw response;
}