Skip to content

Commit

Permalink
Add MsgParseFailure constructor to PoolDbLog.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Sep 8, 2020
1 parent d75b0d5 commit 9708fd4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/core/src/Cardano/Pool/DB/Log.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import Cardano.Wallet.Logging
( BracketLog )
import Cardano.Wallet.Primitive.Types
( EpochNo, PoolId, PoolRetirementCertificate )
import Data.Text
( Text )
import Data.Text.Class
( ToText (..), toText )
import Fmt
Expand All @@ -31,6 +33,7 @@ import qualified Data.Text as T

data PoolDbLog
= MsgGeneric DBLog
| MsgParseFailure Text
| MsgRemovingPool PoolId
| MsgRemovingRetiredPools [PoolRetirementCertificate]
| MsgRemovingRetiredPoolsForEpoch EpochNo BracketLog
Expand All @@ -41,13 +44,18 @@ instance HasPrivacyAnnotation PoolDbLog
instance HasSeverityAnnotation PoolDbLog where
getSeverityAnnotation = \case
MsgGeneric e -> getSeverityAnnotation e
MsgParseFailure {} -> Error
MsgRemovingPool {} -> Notice
MsgRemovingRetiredPools {} -> Debug
MsgRemovingRetiredPoolsForEpoch {} -> Debug

instance ToText PoolDbLog where
toText = \case
MsgGeneric e -> toText e
MsgParseFailure e -> T.unlines
[ "Unexpected parse failure:"
, e
]
MsgRemovingPool p -> mconcat
[ "Removing the following pool from the database: "
, toText p
Expand Down

0 comments on commit 9708fd4

Please sign in to comment.