Posts

Showing posts from August, 2020

Exception in LWC

Image
How to Throw an exception in LWC: Using: Handling Errors on Wired Properties wireApexFunction.js callApexImperative.js Use: ldsUtils provide by salesforce. The reduceErrors helper function in this example comes from the ldsUtils module of the LWC Recipes sample app. LWC Recipes contains easy-to-digest examples of common patterns implemented as Lightning web components. Feel free to copy the ldsUtils module into your project, and use the reduceErrors function. Create a component with : https://github.com/trailheadapps/lwc-recipes/tree/master/force-app/main/default/lwc/ldsUtils **Make is Expose true in Meta.xml Example to Show how to use the 'AuraHandledException' in LWC: Apex class: AccountController.cls public with sharing class AccountController { @AuraEnabled(cacheable=true) public static List<Account> getAccounts() { throw new AuraHandledException('Forced error LWC------->'); //we are commenting return Statment. Thr...