Hi i want the error message to be displayed, i am getting value in response.getError() function, i want message argument in this function.
Below is the snippet of how i'm doing, i am getting undefined in str console statement.
JS
var errors = response.getError();
if (errors) {
var str = errors[0].message;
console.log('str' + JSON.stringify(str));
component.set("v.Error", str);
console.log('Here cmp' + component.get("v.Error")); }
Best Answer
Did you try fetching the error as specified in the documentation for Calling a Server Side Actions here.
In your callback:
This is the part that interests you, validate that the state is in Error and fetch the response error message: