You need to sign in to do that
Don't have an account?
TehNrd
Building a Custom Exception Log
One of this issues we have run across while developing code is notifying the correct people when there is an exception in the production environment. Currently, only the code creator receives the email notification but we would like to notify more than one person. What I have done is created a custom object that is populated when an exception occurs. We would then be able to use work flow to notify the correct people.
Code:
Code:
Code:
trigger triggerName on Object bulk (before insert) { try{ //Trigger Code }catch(Exception e){ Apex_Exception__c error = new Apex_Exception__c( Name = 'Apex Exception - ' + System.now(), Error_Message__c = e.getMessage(), Exception_Type__c = e.getTypeName() ); insert error; } }The shortcoming is that I don't know what trigger and what line caused the exception. Essentially I'd like to re-create the e-mail exception alerts:
Code:
Salesforce Sandbox Apex script unhandled trigger exception by user/organization: ASDF34ARAFAWF/AF3FAW34FAW4I looked over the the system methods but didn't see any that returned Trigger Name or more granular error messages. Anyone know how I can approach this?
productEmailAlertsOnOpportunityProducts: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.productEmailAlertsOnOpportunityProducts: line 33, column 26
Trigger__c = 'Trigger Name';
The only thing I can't figure out how to do is replicate the line and column of where the error occurred.
Message Edited by TehNrd on 09-03-2007 09:50 PM
can we be notified by email when an exception occurs in our Apex code?
-Stian