A very used paradigm when it come with dealing with errors is the try/catch construct.
I've seen advanced programmers actually throwing the message itself as the thrown object, in code that I will simplify as this:
Unfortunately this is a problem, since we got the error message, and it looks good in our 7 lines of code. In reality if our program was a bit bigger, our message was now meaningless, since we would need to find from where the thing was thrown. If the code that can cause the catastrophic failure is called from multiple sites, this only adds to the complexity.
This gives the output:
So please always use Exception objects and avoid space ship tragedies.