Salesforce Certified Platform Developer II — Question 199

A user receives the generic "An internal server error has occurred" while interacting with a custom Lightning Component.
What should the developer do to ensure a more meaningful message?

Answer options

Correct answer: C

Explanation

The correct answer, C, is appropriate because using an AuraHandledException in a try/catch block allows the developer to catch and handle specific exceptions, thus providing a more informative error message. Options A and B do not directly address handling the error contextually, while D is not suitable for handling exceptions in Lightning Components.