You need to sign in to do that
Don't have an account?
Steven P. Schram
Where is documentation for Lightning action response object?
I am encountering expected errors returned in the response argument of my server-side controller action callback function. I can see the error messages in this object by using the Chrome Lightning plugin, but that's only a start. What is the recommended way to pull out these error messages to present to the user? I started with this blog post, but it's very rudimentary and partially inaccurate. For example, the following code from the above blog post is not working for me:
Where can I go for the definitive guide to error handling in Lightning Components, particularly with respect to server side calls?
let errors = response.getError(); let message = 'Unknown error'; // Default error message // Retrieve the error message sent by the server if (errors && Array.isArray(errors) && errors.length > 0) { message = errors[0].message; } // Display the message console.error(message);message is undefined because the errors object is more complex than this.
Where can I go for the definitive guide to error handling in Lightning Components, particularly with respect to server side calls?
https://developer.salesforce.com/blogs/2017/09/error-handling-best-practices-lightning-apex.html
I have since found this question (https://salesforce.stackexchange.com/questions/176979/best-practice-for-catching-and-displaying-action-errors-in-lightning-components) of Stack Exchange. It's a good example of how to handle these errors, but not source material for the data structure.