Skip to content

Commit 80bbd6a

Browse files
Cmdvkderme
authored andcommitted
1421 update logs for Unicode Nul character
1 parent 6eff467 commit 80bbd6a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert/Other.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ insertRedeemerData tracer txId txd = do
8888
case mRedeemerDataId of
8989
Just redeemerDataId -> pure redeemerDataId
9090
Nothing -> do
91-
value <- safeDecodeToJson tracer "insertRedeemerData" $ Generic.txDataValue txd
91+
value <- safeDecodeToJson tracer "insertDatum: Column 'value' in table 'datum' " $ Generic.txDataValue txd
9292
lift
9393
. DB.insertRedeemerData
9494
$ DB.RedeemerData
@@ -113,7 +113,7 @@ insertDatum tracer cache txId txd = do
113113
case mDatumId of
114114
Just datumId -> pure datumId
115115
Nothing -> do
116-
value <- safeDecodeToJson tracer "insertDatum" $ Generic.txDataValue txd
116+
value <- safeDecodeToJson tracer "insertRedeemerData: Column 'value' in table 'redeemer' " $ Generic.txDataValue txd
117117
lift $
118118
insertDatumAndCache cache (Generic.txDataHash txd) $
119119
DB.Datum
@@ -203,7 +203,7 @@ insertScript tracer txId script = do
203203
where
204204
scriptConvert :: MonadIO m => Generic.TxScript -> m (Maybe Text)
205205
scriptConvert s =
206-
maybe (pure Nothing) (safeDecodeToJson tracer "insertScript") (Generic.txScriptJson s)
206+
maybe (pure Nothing) (safeDecodeToJson tracer "insertScript: Column 'json' in table 'script' ") (Generic.txScriptJson s)
207207

208208
insertExtraKeyWitness ::
209209
(MonadBaseControl IO m, MonadIO m) =>

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert/Tx.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ insertTxMetadata tracer txId inOpts mmetadata = do
260260
mkDbTxMetadata (key, md) = do
261261
let jsonbs = LBS.toStrict $ Aeson.encode (metadataValueToJsonNoSchema md)
262262
singleKeyCBORMetadata = serialiseTxMetadataToCbor $ Map.singleton key md
263-
mjson <- safeDecodeToJson tracer "insertTxMetadata" jsonbs
263+
mjson <- safeDecodeToJson tracer "prepareTxMetadata: Column 'json' in table 'metadata' " jsonbs
264264
pure $
265265
Just $
266266
DB.TxMetadata

cardano-db-sync/src/Cardano/DbSync/Era/Util.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ safeDecodeToJson tracer tracePrefix x = do
4747
-- See https://github.com/IntersectMBO/cardano-db-sync/issues/297
4848
if containsUnicodeNul json
4949
then do
50-
liftIO $ logWarning tracer $ tracePrefix <> ": dropped due to a Unicode NUL character. " <> json
50+
liftIO $ logWarning tracer $ tracePrefix <> "was recorded as null, due to a Unicode NUL character found when trying to parse the json."
5151
pure Nothing
5252
else pure $ Just json

0 commit comments

Comments
 (0)