Lecture overview -- Keyboard shortcut: 'u'  Previous page: Conventional Exception Handling [Section] -- Keyboard shortcut: 'p'  Next page: Mixing normal and exceptional cases -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 10 : 30
Object-oriented Programming in C#
Exception Handling
Exception Handling Approaches

  • Printing error messages

    • Console.Out.WriteLine(...)   or   Console.Error.WriteLine(...)

    • Error messages on standard output are - in general - a bad idea

 

  • Returning error codes

    • Like in many C programs

    • In conflict with a functional programming style, where we need to return data

  • Set global error status variables

    • Almost never attractive

  • Raise and handle exceptions

    • A special language mechanism to raise an error

    • Rules for propagation of errors

    • Special language mechanisms for handling of errors