Exception and error processing: Introduction
The terms error and exception are often used interchangeably. In fact, an error, which is an event that happens during the execution of a code, interrupts or disrupts the code's normal flow and creates an exception object. When an error interrupts the flow, the program tries to find an exception handler — a block of code that tells it how to react — that will help it resume the flow. In other words, an error is the event; an exception is the object that the event creates.
Let us overview a simple situation: a user forgot the password. In this situation it is necessary to allow the user to log in a few times. But the application will shut down if there is no error handling mechanism. Another situation: you need to connect but there is a network problem. A simple program will generate the error message and after that it will shut down. An advanced program will try to establish connection one more time, or wait for a few seconds. For this purposes MailBee.NET has exception mechanism.