+ Start a Discussion
yamini prakasam 10yamini prakasam 10 

when we use throw aurahandler exception ,is that it can only used to catch the dml error?can we use this to pass cusstom error message to lighting

David Zhu 🔥David Zhu 🔥
We use System.AuraHandledException to create and throw a server-side controller error and return a custom error message in Aura component development.

Throwing an AuraHandledException('Your error message.') is not only for DML error even though it is used very commonly.
It can be used to any issues. For example, the email entered by user does not match regular expression, a birthdate is after today's date,  data captured fails a webservice validation, and etc.