Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- throw new AuraHandledException('My Custom exception message');
- try {
- //custom logic including dml operations
- } catch (Exception ex) {
- //logic to store log in custom object
- ErrorLog__c errorLog=new ErrorLog__c();
- errorLog.Error_Date_and_Time__c=System.now();
- errorLog.Error_Line_Number__c=ex.getLineNumber();
- errorLog.Error_Message_c__c=ex.getMessage();
- errorLog.Error_Stack_Trace__c=ex.getStackTraceString();
- insert errorLog;
- //logic to notify aura component abt the exception
- throw new AuraHandledException(ex.getMessage());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement