When an error occurs in a function, the code that called the function must be made aware of it; this is called throwing the error. When a function throws an error, it assumes that the code that called the function, or some code further up the chain, will catch and recover appropriately from the error.
To throw an error from a function, we use the throws keyword. This keyword lets the code that called it know that an error may be thrown from the function. Unlike exception handling in other languages, we do not list the specific error types that may be thrown.