aura:systemError

Indicates that an error has occurred.
This event is automatically fired when an error is encountered during the execution of a server-side action. The aura:systemError event is handled by a client-side controller. A component can have only one <aura:handler event="aura:systemError"> tag in markup to handle this event.
<aura:handler event="aura:systemError" action="{!c.handleError}"/>
This example shows a button that triggers an error and a handler for the aura:systemError event .
<aura:component controller="namespace.myController">
    <aura:handler event="aura:systemError" action="{!c.showSystemError}"/>
    <aura:attribute name="response" type="Aura.Action"/>
    <!-- Other component markup here -->
    <ui:button aura:id="trigger" label="Trigger error" press="{!c.trigger}"/>
</aura:component>
This client-side controller triggers the firing of an error and handles that error.
({
    trigger: function(cmp, event) {
        // Call an Apex controller that throws an error
        var action = cmp.get("c.throwError");
        action.setCallback(cmp, function(response){
            cmp.set("v.response", response);
        });
        $A.enqueueAction(action);
    },

    showSystemError: function(cmp, event) {
        // Handle system error
        console.log(cmp);
        console.log(event);
    }
})
The aura:handler tag for the aura:systemError event contains these required attributes.
Attribute Name Type Description
event String The name of the event, which must be set to aura:systemError.
action Object The client-side controller action that handles the event.
The aura:systemError event contains these attributes. You can retrieve the attribute values using event.getParam("attributeName").
Attribute Name Type Description
message String The error message.
error String The error object.