What is "throw"

When casting an exception the normal control flow of a program is interrupted. If this happens within a block execution try, will continue within a block catch or finally, as in the following example of Java:

try {
     throw new RuntimeException ("para demonstrar try-throw-catch");
     System.out.println ("isso não é executado")
} catch (RuntimeException re) {
     System.out.println ("o fluxo de controle vai diretamente aqui");
}

Use or for questions about the capture side of exception handling.

And about the complete process of treating exceptions use .

We have questions here that we can consider as canonical and reading them will learn a lot of what you need to solve your problem: