O'Reilly logo

The Developer’s Guide to the Force.com Platform by Phil Choi, Andrew Fawcett, Glen Martin, Rick Greenwald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Apex Exception Handling

Of course, we all write perfect code, first time through. At least, that’s what we wake up every morning hoping to accomplish–a hope that is normally dashed within the first 15 minutes of coding.

Any of the Apex development environments parse your code before allowing the code to be saved. This enforcement means that your code is syntactically correct, but there is no guarantee that the code will not encounter error conditions at run-time.

When an Apex trigger or class encounters an error at runtime, the Force Platform environment throws an exception and terminates the execution of the code immediately. You can include code that allows you to handle exceptions more gracefully with try/catch syntax.

The form for try/catch ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required