Skip to main content

An exception denotes an error that disrupts the normal flow of code execution.

You can use Apex built-in exceptions or create custom exceptions. All exceptions have common methods.

All exceptions support built-in methods for returning the error message and exception type. In addition to the standard Exception class, there are several different types of exceptions.

To create your custom exception class, extend the built-in Exception class and make sure your class name ends with the word Exception. Append extends Exception after your class declaration.

Useful Documentation