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 !


If you are using record.addError('ABC'); in the trigger handler, your LWC should catch that error. It can be displayed pretty simply, check out this post here for a description of how to handle aura handled exceptions within a Lighting Web Component.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.