Skip to content

JPipkin/User-Friendly-Error-Messages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Displays user-friendly messages when apex throws an exception.

Custom setting "FriendlyMessages__c" controls what is displayed to the user in the Salesforce UI

*** USAGE ***

On DML calls in Apex, use try/catch blocks to catch the exception instance FOR TRIGGER CONTEXT: try{ insert newAccount; } catch(Exception e){ FriendlyErrorException fee = new FriendlyErrorException(Trigger.new, e); fee.throwIt(); }

OUTSIDE TRIGGER CONTEXT: try{ insert newAccount; } catch(Exception e){ FriendlyErrorException fee = new FriendlyErrorException(new SObject[] {newAccount}, e); fee.throwIt(); }

VISUALFORCE PAGE try{ insert newAccount; } catch(Exception e){ FriendlyErrorException fee = new FriendlyErrorException(new SObject[] {newAccount}, e); ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, fee.my_exception.display)); }

About

Displays user-friendly error messages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages