Message Boards Message Boards


Exception handling in Mathematica

Posted 10 days ago
0 Replies
0 Total Likes

What is the cleanest way to handle exceptions in Mathematica. For example:

(* import the Zoom report *) ecicc = Import[SystemDialogInput["FileOpen"]]; (* convert the Zoom dates into DateObjects *) <more code goes here>

I want to let the user select a file, and then process the contents. However, if no file is selected, e.g. Cancel is clicked, I need to not execute the code. Obviously, I could wrap all the code in an If statement, but that seems very clumsy. How do Mathematica programmers handle this situation in a functional style?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract