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
dvf1976dvf1976 

Is there a way to 'catch' an Exception that bubbles all the way to a script exception?

I would like to capture all times that SFDC throws an exception that it can't handle.

 

By 'capture' I mean that I want to set up an object that takes the output from:

 

e.getStackTraceString() and puts it into an instance with an attribute 'StackTrace__c'

 

The object set-up is the easy part. :)


The hard part is figuring out if there's a way to make Apex code's uncaught exceptions 'caught' and captured in a central place.

 

Does anyone know if this is possible?

DCBoyDCBoy

Uncaught exceptions are typically sent to the user who last modified the trigger/class from which the exception originated. We have configured a dummy user and assigned a mailer as its email address. An Inbound Email Service can be configured to store the exceptions in an object. This article on developer force will be helpful.