Definition: trap
To respond to a particular condition in a running program; for example, to "trap an interrupt" means to wait for a particular interrupt to occur and then redirect the computer to execute an appropriate routine. An "error trap" tests for an invalid set of data. It then displays the correct error message and bypasses processing that data. A "debugging trap" looks for the execution of a particular instruction in order to immediately stop the program and analyze the status of the system at that moment.