Why don't we use "to generate" or "to get"?
see: https://en.wikipedia.org/wiki/Exception_handling at History
"... Software exception handling developed in Lisp in the 1960s and 1970s. This originated in LISP 1.5 (1962), where exceptions were caught by the ERRSET keyword, which returned NIL in case of an error, instead of terminating the program or entering the debugger. Error raising was introduced in MacLisp in the late 1960s via the ERR keyword. This was rapidly used not only for error raising, but for non-local control flow, and thus was augmented by two new keywords, CATCH and THROW (MacLisp June 1972), reserving ERRSET and ERR for error handling. ..."
An attestation of "threw an error" on page 663 of The Electrical World and Engineer. New York, 1900.
And here's one of "throws an error": on page 323 of Productive Dairying. Philadelphia, 1917.
And here's one of "throws errors": on unknown page (thanks, Google) of Techniques of Plant Maintenance and Engineering. Madison Wisconsin, 1950.
The concept of exceptions originated in the programming language Lisp. Originally, a part of a program might cause an error to occur. You could specify a way for the program to continue executing on an error — in modern terminology, a way to handle the error. Then a mechanism was added to signal an error, i.e. to artificially cause an error condition, which allowed programmers to make use of the error handling mechanism for things that were not errors. This history is described in “A Pattern of Language Evolution” by Richard P. Gabriel and Guy L. Steele Jr..
The terms throw and catch appeared in 1972 in MACLISP. One of the first published work including those terms was the 1974 MACLISP Reference Manual by David A. Moon (§5.3 p.43). The mechanism is described as non-local exit. This means “jumping” from one point of the program to another, which generalizes what happens when an error occurs. The word exception was not used yet in the software community at the time. You didn't “throw an error” or “throw an exception” back then, you threw a value from one part of the program (the
throw instruction) to another (the
catch instruction), together with a tag indicating where to throw it to. Exceptions later evolved as a data structure combining the tag and the value.
This is a term specific to programming. Exceptions are 'thrown' which are 'caught' most often by an execution component. This shows the relationship between the exception, which is the initial event in the interaction, and the execution, which is a response event.
Quote from the Wikipedia article on Exception Handling:
"Software exception handling and the support provided by software tools differs somewhat from what is understood under exception in hardware, but similar concepts are involved. In programming language mechanisms for exception handling, the term exception is typically used in a specific sense to denote a data structure storing information about an exceptional condition. One mechanism to transfer control, or raise an exception, is known as a throw. The exception is said to be thrown. Execution is transferred to a "catch"."
It may not reflect the original etymology of the word, but one factor that makes the etymology apt for exception handling is that our model for how exceptions work ties into our existing notion of the call stack. In programming languages with functions or procedures, each nested function call causes the "call stack" to grow downwards, to a greater stack "depth". Less-nested calls are said to be "higher" on the call stack.
When an exception gets caught in a
catch block (or
except block, or
rescue block, or whatever it's named in a particular language), that block is generally higher on the call stack than the point at which the exception occurred. Thus the two synonymous verbs we use to describe that event - either "raising" or "throwing" the exception - both make sense within the call stack metaphor. We can either imagine the exception rising through the call stack until it reaches the
catch block that handles it, or we can imagine the deeper function "throwing" the exception up, like a ball, to the catch clause in a higher stack frame. Either way, the common point in the metaphor underlying both verbs is that exceptions travel upwards.