function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.