Salesforce Certified Application Architect

Tuesday 6 February 2018

AuraHandledException in Lightening

From Apex class:

    @AuraEnabled
    public static List<Account> fetchAccount() {
        throw new AuraHandledException('User-defined error');
    }
  From client-side controller:
  doInit: function(component, event, helper) {
        var action = component.get('c.fetchAccount');
        action.setParams({ firstName : cmp.get("v.firstName") });
        action.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
        component.set('v.Accounts', response.getReturnValue());
        }
        else if (component.isValid() && state === "ERROR") {
     console.log("Error Message: ", response.getError()[0].message);
        }
        });
        $A.enqueueAction(action);
    } 

No comments:

Post a Comment

Salesforce Certified Application Architect & Certified Data Architecture and Management Designer Exam

How to pass Salesforce Certified Data Architecture and Management Designer Exam This exam was 1st architect exam for me. Its not that muc...