LWCIntermediatewireerror-handlingux
Handle @wire error and loading states without blank component shell
Real World Scenario
Users report broken widgets when wire fails FLS denial—component renders empty with no message.
Expected Answer
• Destructuring wire into data error and explicit loading derivation
• if (error) branch showing permission or retry message not empty div
• Distinguish wire loading from imperative loading in combined component
• Map error.status and body to user-friendly Custom Label messages
• Log error body correlation Id server-side not in toast
• Retry wire via refreshApex on user click after permission fix
• Jest test wire error emit asserting error UI visible
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Main difference: use case and scale. Destructuring wire into data error and explicit loading derivation. if (error) branch showing permission or retry message not empty div. Pick based on your integration pattern and team capability. Wire error UI is definition of done—empty component on error is support ticket factory. Balance speed of delivery with maintainability.
Architect Perspective
Wire error UI is definition of done—empty component on error is support ticket factory.