WLJS LogoWLJS Notebook

Enclose

Enclose[expr] evaluates expr and returns the result, but catches any errors from Confirm and returns a Failure object.

Examples

Basic error handling:

Enclose[
  x = Confirm[1/0];
  x + 1
]
(* Failure[...] *)

Successful evaluation:

Enclose[
  x = Confirm[5];
  x + 1
]
(* 6 *)

Handle failure:

Enclose[computation[], "Message" &]

Please visit the official Wolfram Language Reference for more details.

On this page