ABSTRACT

There are many reasons why faults develop during the execution of programs. The chapter begins with the differentiation between the terms “error,” “defect,” and “fault,” giving their definitions. The facilities usually provided for handling errors in the operating system (OS) are discussed to begin with, followed by an explanation on how the OS handles an error condition during the program execution. Undesirable consequences like losing important data may result in leaving it to the OS to handle faults. The errors in the code can result from many reasons, including the use of third-party code libraries, faults in the OS, errors in the application framework, the DBMS and webserver, and so on. Therefore, the programmer must foresee and insert error handling statements in the program to prevent the execution going to the control of the OS. We need to insert error handling statements in the program so the user is allowed to smoothly exit the program or navigated to other functionality. Errors are usually classified as minor errors, major errors, and critical errors. We need to prevent errors in our code and then insert statements in our program at every conceivable location in our program where we see the possibility of a fault developing to trap all possible faults. The chapter discusses the situations where an error can creep in and how to prevent them. We also need to program alternative actions that can be executed when a fault develops during execution. The responsibility for error handling is shared by both the software designer and the programmer. All these aspects are described in detail in this chapter.