Meaning – The term exception, refers to an event that occurs during the execution of a program, and disrupts the regular flow of instructions. In some cases, the computer can handle the exception on its own and the program continues to run. However, if the exception is severe, then the program may be forced to quit.
In many programming languages, exceptions are supported and used to control the flow of the program. Other languages only use exceptions to catch fundamental runtime errors, such as failure allocating memory or system-level errors.
If the developer has done his/her research before writing the code, then the code should ideally feature exception handling instructions that will help the program automatically handle any resulting exceptions during execution.
Example of usage – “A C++ program may throw the bad_alloc exception when memory cannot be allocated and the system_error exception when the operating system produces an error.”