Hi there,
Is this a bug when I try to write the test case - testRollback? Because the compiler would still complain that it’s a “Unhandled exception”. And furthermore when I run
daml test --show-coverage
, it’ll show the test case failed. Any idea from anyone? Thanks in advance.
data RollbackErrorCode =
VALIDATION_FAILED
deriving (Eq, Ord, Show)
exception RollbackException
with
errorCode : RollbackErrorCode
errorMsg : Text
where
message "RollbackException msg: errorCode - " <> show errorCode <> " , errorMsg - " <> show errorMsg
template TempRollback
with
a: Text
owner: Party
where
signatory owner
choice Test : ()
controller owner
do
throw $ RollbackException VALIDATION_FAILED "abc"
pure ()
testRollback = do
alice <- allocateParty "Alice"
cid <- submit alice do
createCmd TempRollback with
a = "aapple"
owner = alice
try do
submit alice do
exerciseCmd cid Test
catch
RollbackException _ _ ->
pure ()
pure ()