Activity Forums Salesforce® Discussions What is throw new AuraHandledException() in Salesforce?

  • Deepak

    Member
    September 10, 2019 at 11:58 am

    Create and throw a System.AuraHandledException from your server-side controller to return a custom error message.
    Errors happen. Sometimes they’re expected, such as invalid input from a user, or a duplicate record in a database. Sometimes they’re unexpected, such as... Well, if you’ve been programming for any length of time, you know that the range of unexpected errors is nearly infinite.

    When your server-side controller code experiences an error, two things can happen. You can catch it there and handle it in Apex. Otherwise, the error is passed back in the controller’s response.

    If you handle the error Apex, you again have two ways you can go. You can process the error, perhaps recovering from it, and return a normal response to the client. Or, you can create and throw an AuraHandledException.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos