If an error occurs when your program is running, BASIC diagnoses the error and displays a message telling the nature and severity of the error, and the program line and module where the error occurred. Your program can handle most errors with WHEN ERROR constructs. A WHEN ERROR construct contains a block of code called a protected region that is monitored by the compiler for the occurrence of an error. If an error occurs within a protected region, control can be transferred to either an attached or detached handler. If you do not include an error handler, BASIC handles the error. The severity of an error determines whether or not the program aborts when the error occurs.