Skip to content

Commit

Permalink
Attempt to get more information about miner error HttpExceptionRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
dmp1ce committed Nov 8, 2019
1 parent 8c1b564 commit 395d389
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/CheckCgminer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import Data.Either (lefts)
import Numeric (showFFloat)
import Data.Time.Clock (nominalDay)
import Text.Printf (printf)
import Control.Exception (try, SomeException (SomeException))

import CgminerApi ( QueryApi (QueryApi), getStats, getSummary, decodeReply, Stats (Stats)
, TextRationalPairs, ReplyApi)
Expand Down Expand Up @@ -426,7 +427,11 @@ instance ToPerfData PerfDataWorkMode where
-- | Try to parse stats from miner. Return error `T.Text` if for failure.
tryCommand :: T.Text -> (ReplyApi -> Either String Stats) -> CliOptions -> IO (Either T.Text Stats)
tryCommand c f (CliOptions h p _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _) = do
r <- sendCGMinerCommand h p c
re <- try (sendCGMinerCommand h p c)

let r = case re of
Right a -> a
Left (SomeException e) -> error $ "sendCGMinerCommand error: " ++ (show e)

-- Uncomment for getting the raw reply from a miner for testing
--print r
Expand Down

0 comments on commit 395d389

Please sign in to comment.