• Nicolas Astier
  • NEWBIE
  • 15 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi,
I've hadded a lightning component's button to modify current opportunity via apex. 
I'm printing the result of the operation and in case of an error, I would like to print the error's message.
I'm inducing an error "update failed" but I can't seem to get the error message in the window
This is the part of my code to handle errors so far:
} else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        component.set("v.messageError", errors[0].message);
                    }
                    else {
                         component.set("v.messageError", errors.message);
                    } 
                } else {
                     component.set("v.messageError", "unknown error");
                }
}
<aura:iteration items="{!v.errorMessages2}" var="message2">
                        <li class="minli"><h3> ResultMessage: {!v.messageError} </h3></li>
</aura:iteration>
apex:
catch(Exception e) {
                throw e;
}

results:
WindowError in Logs


 
Hi,
I've hadded a lightning component's button to modify current opportunity via apex. 
I'm printing the result of the operation and in case of an error, I would like to print the error's message.
I'm inducing an error "update failed" but I can't seem to get the error message in the window
This is the part of my code to handle errors so far:
} else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        component.set("v.messageError", errors[0].message);
                    }
                    else {
                         component.set("v.messageError", errors.message);
                    } 
                } else {
                     component.set("v.messageError", "unknown error");
                }
}
<aura:iteration items="{!v.errorMessages2}" var="message2">
                        <li class="minli"><h3> ResultMessage: {!v.messageError} </h3></li>
</aura:iteration>
apex:
catch(Exception e) {
                throw e;
}

results:
WindowError in Logs