+ Start a Discussion
tomasddtomasdd 

How to catch server error in JS for LWC

How can I catch the server error message in JS for LWC. I have a trigger for object A and for this object I have LWC where I adding new records. Trigger checking whether percents on object is equal 100. When record has less than 100% show message "ABC".
I would like to get the same error message when I creating new record using LWC. How may I do this using JS for LWC ?
Thanks !
Anil Bolisetty 2Anil Bolisetty 2
Use throw new aurahandled excpetion in apex and catch in error statement in lwc js