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
Lightning CobraLightning Cobra 

log exception severity into a custom object

Hello,
I have designed how exceptions will be logged into a custom object in salesforce.I am trying to figure out a way to log severity into that custom object as well. With exception class methods provided by salesforce, i am unable to derive the severity information something like we usually get with apexpages.severity (message class).

Question here is,
1) Can i write the apexpages.severity into the "log" custom object which has a field to capture severity (picklist field with values: Error, Fatal, Warning) along with getCause, getLineNumber, getMessage, getStackTraceString, getTypeName from exception class?
2) If capturing exceptions using exceptions class, how can i get the severity?

Thanks.
Raj VakatiRaj Vakati
Hi , 
I don't think so you can get severity in Apex Error or Exception Objects.What you can do is identify some key parts in the code where you can store in custom object based on error handling logic