Episode 7: Error Handling

Topics covered
Popular Clips
Episode Highlights
Local Handling
The concept of handling exceptions locally is rooted in the design by contract principles, which suggest that each component should manage its own errors. Priyanka Raghavan and Bertrand Meyer discuss how this approach can lead to excessive catch blocks, complicating code readability and maintainability 1. They argue that while local handling is essential for fulfilling a component's contract, it can result in bloated code when exceptions are merely rewrapped without meaningful processing 2. Meyer notes, "If we do local exception handling, there's the danger of having catch blocks all over the place... it bloats a one line method to 30, 40 lines of code."
High-Level Handling
A shift towards handling exceptions at a higher architectural level is proposed for better maintainability. Bertrand Meyer suggests using a high-level catch block to manage exceptions, reducing the need for numerous local catch blocks that often fail to handle errors effectively 3. This approach allows for centralized error processing, ensuring that exceptions are managed consistently across the system 2. Meyer emphasizes, "If there's something you cannot handle, don't fake it... it's good to have one place high up the call chain that catches everything and does the processing there."
Related Episodes


Episode 21: Error Handling Pt. 2
Answers 383 questions

Episode 17: Feedback and Roadmap
Answers 383 questions

Episode 441 Shipping Software - With Bugs
Answers 383 questions

Episode 2: Dependencies
Answers 383 questions
Episode 78: Fault Tolerance with Bob Hanmer Pt. 2
Answers 383 questions

Episode 28: Type Systems
Answers 383 questions

Episode 31: Agile Documentation
Answers 383 questionsEpisode 147: Software Development Manager
Answers 383 questions

Episode 46: Refactoring Pt. 1
Answers 383 questions

Episode 77: Fault Tolerance with Bob Hanmer Pt. 1
Answers 383 questions

Episode 55: Refactoring Pt. 2
Answers 383 questions
Episode 103: 10 years of Agile Experiences
Answers 383 questions

SE-Radio-Episode-280-Gerald-Weinberg-on-Bugs-Errors-and-Software-Quality
Answers 383 questions

Episode 112: Roles in Software Engineering II
Answers 383 questions








