Skip to content

Commit

Permalink
logs: Add a more verbose error for enforce-verifier in Local mode
Browse files Browse the repository at this point in the history
"not in scope" is just not enough info in local mode.
  • Loading branch information
edmundnoble committed May 7, 2024
1 parent 8240f2e commit 28c140a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Pact/Native/Capabilities.hs
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,20 @@ enforceVerifierDef = defRNative
unless inCap $
failTx (getInfo i) $ "enforce-verifier must be run in a capability"
verifierInScope <- anyCapabilityBeingEvaluated verCaps
mode <- view eeMode
if verifierInScope then return (toTerm True)
else failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": not in scope"
else case mode of
Transactional ->
failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": not in scope"
Local -> do
capsBeingEvaluated <- use evalUserCapabilitiesBeingEvaluated
failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": " <> vsep
[ "Capabilities being evaluated:"
, pretty (S.toList capsBeingEvaluated)
, "Capabilities associated to this verifier:"
, pretty (S.toList verCaps)
]

Nothing ->
failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": not in transaction"
_ -> argsError i as

0 comments on commit 28c140a

Please sign in to comment.