changes log epoch to use text instead of word64 due to overflow issues (#81)

This commit is contained in:
Keagan McClelland
2021-11-23 17:24:54 -07:00
parent 7b402d4039
commit c2af96f9de
2 changed files with 3 additions and 10 deletions

View File

@@ -2,11 +2,9 @@
{-# LANGUAGE TypeApplications #-}
module Handler.ErrorLogs where
import Control.Monad ( MonadFail(fail) )
import Data.Aeson ( (.:)
, FromJSON(parseJSON)
, withObject
, withText
)
import Foundation
import Model ( EntityField(ErrorLogRecordIncidents)
@@ -20,7 +18,7 @@ import Yesod.Persist ( (+=.)
)
data ErrorLog = ErrorLog
{ errorLogEpoch :: Word64
{ errorLogEpoch :: Text
, errorLogCommitHash :: Text
, errorLogSourceFile :: Text
, errorLogLine :: Word32
@@ -32,12 +30,7 @@ data ErrorLog = ErrorLog
instance FromJSON ErrorLog where
parseJSON = withObject "Error Log" $ \o -> do
errorLogEpoch <- o .: "log-epoch" >>= withText
"Word64"
(\t -> case readMaybe t of
Nothing -> fail "Invalid Log Epoch"
Just x -> pure x
)
errorLogEpoch <- o .: "log-epoch"
errorLogCommitHash <- o .: "commit-hash"
errorLogSourceFile <- o .: "file"
errorLogLine <- o .: "line"

View File

@@ -82,7 +82,7 @@ EosHash
ErrorLogRecord
createdAt UTCTime
epoch Word64
epoch Text
commitHash Text
sourceFile Text
line Word32