Published Sep 3, 2019

Episode 7: Error Handling

    Delve into sophisticated error handling strategies at the architectural level with insights from Arno, Markus, Bertrand Meyer, and Priyanka Raghavan, as they dissect the balance between local and global exception handling, the role of Design by Contract, and effective methodologies for managing software bugs and infrastructure problems.
    Episode Highlights
    Software Engineering Radio - the podcast for professional software developers logo

    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