Skip to content

Commit 28c140a

Browse files
committed
logs: Add a more verbose error for enforce-verifier in Local mode
"not in scope" is just not enough info in local mode.
1 parent 8240f2e commit 28c140a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Pact/Native/Capabilities.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,20 @@ enforceVerifierDef = defRNative
287287
unless inCap $
288288
failTx (getInfo i) $ "enforce-verifier must be run in a capability"
289289
verifierInScope <- anyCapabilityBeingEvaluated verCaps
290+
mode <- view eeMode
290291
if verifierInScope then return (toTerm True)
291-
else failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": not in scope"
292+
else case mode of
293+
Transactional ->
294+
failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": not in scope"
295+
Local -> do
296+
capsBeingEvaluated <- use evalUserCapabilitiesBeingEvaluated
297+
failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": " <> vsep
298+
[ "Capabilities being evaluated:"
299+
, pretty (S.toList capsBeingEvaluated)
300+
, "Capabilities associated to this verifier:"
301+
, pretty (S.toList verCaps)
302+
]
303+
292304
Nothing ->
293305
failTx (getInfo i) $ "Verifier failure " <> pretty verName <> ": not in transaction"
294306
_ -> argsError i as

0 commit comments

Comments
 (0)