function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hamayoun65hamayoun65 

Exceptions in @future methods

I am using an @future method.  I am seeing some failures in the Apex Log, but there is no information there as to why it failed.  In addition, the usual 'Developer Script Exception' email is NOT being sent out.  Now I suspect that there is a problem with the governor limits.  But I seem to have hit a problem in trying to verify this.  The Dev Guide says:

 

When a batch Apex job is run, email notifications are not sent to the LastModifiedBy

user who changed the class when the exception occurred. You must create your own facility for exception handling such as sending an email message using Apex when an exception occurs. 

 

Assuming that what holds for batch Apex jobs is also true for @future methods, this would mean I would need to put a try-catch clause in my method, and email the necessary contacts in the catch.  However, the Dev Guide also says this:

 

Limit exceptions caused by an execution governor cannot be caught. 

 

This sounds like a Catch 22.... @future methoods won't send notifications caused by exceeding governor limits, but doesn't allow you to catch them either!   Can someone please help me out here????