Skip to content

Commit

Permalink
Do not show the cause of an error when it's a typed 'Error'
Browse files Browse the repository at this point in the history
  • Loading branch information
effectfully committed Nov 20, 2020
1 parent 96ce97d commit 573a143
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions plutus-core/src/Language/PlutusCore/Evaluation/Machine/Cek.hs
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ computeCek ctx env (Builtin ex bn) = do
BuiltinRuntime _ arity _ _ <- asksM $ lookupBuiltin bn . cekEnvRuntime
returnCek ctx (VBuiltin ex bn arity arity [] [] env)
-- s ; ρ ▻ error A ↦ <> A
computeCek _ _ err@Error{} =
throwingWithCause _EvaluationError (UserEvaluationError CekEvaluationFailure) $ Just $ void err
computeCek _ _ Error{} =
throwingWithCause _EvaluationError (UserEvaluationError CekEvaluationFailure) Nothing
-- s ; ρ ▻ x ↦ s ◅ ρ[ x ]
computeCek ctx env (Var _ varName) = do
spendBudget BVar (ExBudget 1 1) -- TODO
Expand Down
4 changes: 2 additions & 2 deletions plutus-core/src/Language/PlutusCore/Evaluation/Machine/Ck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ stack |> Builtin _ bn = do
BuiltinRuntime _ arity _ _ <- asksM $ lookupBuiltin bn . ckEnvRuntime
stack <| VBuiltin bn arity arity [] []
stack |> Constant _ val = stack <| VCon val
_ |> err@Error{} =
throwingWithCause _EvaluationError (UserEvaluationError CkEvaluationFailure) $ Just err
_ |> Error{} =
throwingWithCause _EvaluationError (UserEvaluationError CkEvaluationFailure) Nothing
_ |> var@Var{} =
throwingWithCause _MachineError OpenTermEvaluatedMachineError $ Just var

Expand Down
3 changes: 1 addition & 2 deletions plutus-core/test/Evaluation/Golden/polyErrorInst.plc.golden
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
(Left An error has occurred: User error:
The provided Plutus code called 'error'.
Caused by: (error a_0))
The provided Plutus code called 'error'.)

0 comments on commit 573a143

Please sign in to comment.