Added ML style functional exception handling.

Using the new "ifThrown" function in the std.exception module.
Merge pull request #1090 from someboddy/add-ml-style-exception-handling

Add ML style exception handling