Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
[#676] Use Cardano.Prelude panic
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuesch committed Jan 2, 2020
1 parent 019a212 commit 720a4dc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cardano-ledger/src/Cardano/Chain/Byron/Auxiliary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import Data.Sequence (Seq)
import qualified Data.Sequence as Seq
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.Text as T
import Data.Word
import GHC.Generics (Generic)

Expand Down Expand Up @@ -412,7 +413,7 @@ mkUpdateEnvironment cfg state = U.Iface.Environment {
-- function can just be used directly.
toNumGenKeys :: Int -> Word8
toNumGenKeys n
| n > fromIntegral (maxBound :: Word8) = error $
| n > fromIntegral (maxBound :: Word8) = panic $
"toNumGenKeys: Too many genesis keys"
| otherwise = fromIntegral n

Expand Down Expand Up @@ -584,8 +585,8 @@ reAnnotateUsing encoder decoder =
| otherwise = roundtripFailure "leftover bytes"
splice _ (Left err) = roundtripFailure $ show err

roundtripFailure :: forall x. String -> x
roundtripFailure err = error $ intercalate ": " $ [
roundtripFailure :: forall x. T.Text -> x
roundtripFailure err = panic $ T.intercalate ": " $ [
"annotateBoundary"
, "serialization roundtrip failure"
, show err
Expand All @@ -609,7 +610,7 @@ fromCBORABlockOrBoundaryHdr epochSlots = do
fromCBOR @Word >>= \case
0 -> ABOBBoundaryHdr <$> CC.fromCBORABoundaryHeader
1 -> ABOBBlockHdr <$> CC.fromCBORAHeader epochSlots
t -> error $ "Unknown tag in encoded HeaderOrBoundary" <> show t
t -> panic $ "Unknown tag in encoded HeaderOrBoundary" <> show t

-- | The analogue of 'Data.Either.either'
aBlockOrBoundaryHdr :: (CC.AHeader a -> b)
Expand Down

0 comments on commit 720a4dc

Please sign in to comment.