Skip to content

Commit

Permalink
Better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
msooseth committed Jan 20, 2025
1 parent fd65aad commit f0c3246
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/EVM/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,14 @@ readFoundryJSON contractName json = do
runtimeCode <- maybeToEither "missing 'deployedBytecode.object' field" $
(toCode contractName) . strip0x'' <$> runtime ^? key "object" % _String
runtimeSrcMap <- case runtime ^? key "sourceMap" % _String of
Nothing -> Right $ force "" $ makeSrcMaps "" -- sourceMap is optional
Nothing -> Right $ force "Source map creation error" $ makeSrcMaps "" -- sourceMap is optional
Just smap -> maybeToEither "invalid sourceMap format" $ makeSrcMaps smap

creation <- maybeToEither "missing 'bytecode' field" $ json ^? key "bytecode"
creationCode <- maybeToEither "missing 'bytecode.object' field" $
(toCode contractName) . strip0x'' <$> creation ^? key "object" % _String
creationSrcMap <- case creation ^? key "sourceMap" % _String of
Nothing -> Right $ force "" $ makeSrcMaps "" -- sourceMap is optional
Nothing -> Right $ force "Source map creation error" $ makeSrcMaps "" -- sourceMap is optional
Just smap -> maybeToEither "invalid sourceMap format" $ makeSrcMaps smap

ast <- maybeToEither "missing 'ast' field. Recmpile with `forge clean && forge build --ast`" $ json ^? key "ast"
Expand Down

0 comments on commit f0c3246

Please sign in to comment.