Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. throw new AuraHandledException('My Custom exception message');
  2.  
  3. try {
  4.  
  5. //custom logic including dml operations
  6.  
  7. } catch (Exception ex) {
  8.  
  9. //logic to store log in custom object
  10.  
  11. ErrorLog__c errorLog=new ErrorLog__c();
  12. errorLog.Error_Date_and_Time__c=System.now();
  13. errorLog.Error_Line_Number__c=ex.getLineNumber();
  14. errorLog.Error_Message_c__c=ex.getMessage();
  15. errorLog.Error_Stack_Trace__c=ex.getStackTraceString();
  16. insert errorLog;
  17.  
  18. //logic to notify aura component abt the exception
  19.  
  20. throw new AuraHandledException(ex.getMessage());
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement