We have an error log object where we store the errors and I have a simple try catch like below... My issue is that the insert in the finally does not appear to be happening. Any advice? or is that a limitation in the try-catch error handling?
list<Error_Log__c> error_logs = new list<Error_Log__c> ()
try {
if(status__c == '100') {
\\do something
} else {
throw new AuraHandledException('System Error');
}
} Catch (Exception e) {
Error_Log__c rec = new Error_Log__c(Name="Error Message: ");
error_logs.add(rec);
throw new AuraHandledException('System Error');
} finally {
insert error_logs;
}