Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Sep 23, 2024
1 parent 38501ad commit 187a060
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cardano-cli/src/Cardano/CLI/Run/Hash.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Control.Monad.Catch (Exception, Handler (Handler))
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString.Lazy.Char8 as BSL8
import Data.Char (toLower)
import Data.Function
import Data.List (intercalate)
Expand Down Expand Up @@ -129,7 +130,11 @@ getByteStringFromURL supportedSchemas urlText = do
response <- httpLbs request manager
let status = responseStatus response
if statusCode status /= 200
then throw $ BadStatusCodeHRE (statusCode status) (BS8.unpack $ statusMessage status)
then
throw $
BadStatusCodeHRE
(statusCode status)
(BS8.unpack (statusMessage status) ++ ':' : BSL8.unpack (responseBody response))
else return $ BS.concat . BSL.toChunks $ responseBody response

handlers :: [Handler IO FetchURLError]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ instance Error GovernanceActionsError where
GovernanceActionsProposalFetchURLError adt fetchErr ->
"Error while checking "
<> pretty (anchorDataTypeCheckName adt)
<> " hash:"
<> " hash: "
<> pretty (displayException fetchErr)

data AnchorDataTypeCheck = ProposalCheck
Expand Down

0 comments on commit 187a060

Please sign in to comment.