Using the Body of the Code to Handle Custom Errors
The following image includes an example that uses the body of the code to handle a custom error.

Explanation of Callouts
The example that uses the body of the code to handle a custom error includes the following items:
Place the code that handles the error immediately before the line of code that could cause an error.
You use the Error statement to set the custom error to a value of 30000.