A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

For reasons I don't understand, you have to invoke the setMessage method to output a custom message on the client-side: String m = 'My cusom msg here'; AuraHandledException e = new AuraHandledException(m); e.setMessage(m); throw e;


If you want to do this, you need a component that represents the child and you need to have the change handlers for its presentation to generate an event. You then have the parent component manage the child components and have a handler that handles the events from the children as needed. Take a look at the documentation for more advice.


You need to ask the server's response for the actual message, rather than just passing the error object to your Toast event. There are some great, thorough examples on the Salesforce Developer Blog. Here's their example of how to handle an error return via a Toast message, in a helper function: handleErrors : function(errors) { // Configure error toast ...

Only top voted, non community-wiki answers of a minimum length are eligible