Exception Handling
Aura Exception Handling
Using the Aura exception handling factory enables developer/user friendly error messages based on the exception type.
Usages
@AuraEnabled
public static String getSomething()
{
try {
// do something
} catch (Exception cause) {
throw AuraHandledExceptionFactory.create(cause);
}
}
Basic Aura Handled Exception Factory class
Basic solution enables developer friendly error messages when unit testing.
Advanced Aura Handled Exception Factory class
Following the Open/Closed Principle this solution allows developers to implement custom error message responses based on the exception type.
Exception Handler
Dml Exception Handler
Last updated