summaryrefslogtreecommitdiff
path: root/haskell
diff options
context:
space:
mode:
Diffstat (limited to 'haskell')
-rw-r--r--haskell/package.yaml1
-rw-r--r--haskell/src/SpaceTraders/APIClient/Client.hs7
2 files changed, 8 insertions, 0 deletions
diff --git a/haskell/package.yaml b/haskell/package.yaml
index 567b06c..8ecfa55 100644
--- a/haskell/package.yaml
+++ b/haskell/package.yaml
@@ -27,6 +27,7 @@ dependencies:
- text
- time
- transformers
+- unix
ghc-options:
- -Wall
diff --git a/haskell/src/SpaceTraders/APIClient/Client.hs b/haskell/src/SpaceTraders/APIClient/Client.hs
index 87147b6..0f0cf27 100644
--- a/haskell/src/SpaceTraders/APIClient/Client.hs
+++ b/haskell/src/SpaceTraders/APIClient/Client.hs
@@ -23,6 +23,8 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Network.HTTP.Simple
import Network.HTTP.Types.Status
+import System.Environment
+import System.Posix.Process
import SpaceTraders.APIClient.Errors
import SpaceTraders.APIClient.Pagination
@@ -81,4 +83,9 @@ sendPaginated request = do
Right (APIRateLimit r) -> do
threadDelay (1_000_000 * (round $ retryAfter r))
sendPaginated request
+ Right (APIResetHappened _) -> do
+ p <- getExecutablePath
+ a <- getArgs
+ e <- getEnvironment
+ executeFile p False a (Just e)
Right e -> return $ Left e