Whenever you're ready, walk me through how you'd approach this.
How do you handle API errors or unexpected data responses in a frontend or backend environment?
Explain how you distinguish transport failures, HTTP error responses, malformed payloads, and valid responses containing business-level errors. Cover validation, user-facing behavior, retries, logging, and testing. Keep the answer language and framework agnostic, but include one concrete implementation example.