Top "Throw" questions

throw is a keyword in various languages used for signaling an exception.

Throw exception and return result from a function

I'm just learning C++, and would like to throw an exception, but then the result of my function would be …

c++ exception throw
How to make a mock object throw an exception in Google Mock?

With Google Mock 1.7.0, I have a mock object with a method, and I want to expect it to be called, …

c++ unit-testing exception throw googlemock
Does throw inside a catch ellipsis (...) rethrow the original error in C++?

If in my code I have the following snippet: try { doSomething(); } catch (...) { doSomethingElse(); throw; } Will the throw rethrow the specific …

c++ exception throw ellipsis
A standard way in C++ to define an exception class and to throw exceptions

I want to build a class with functions that may throw exceptions that I want to catch when I use …

c++ exception standards instance throw
Can throw be used instead of break in a switch statement?

Can throw also be used to exit switch statement without using break keyword? Why use a throw instead of break? …

java oop exception throw
How to throw InvalidArgumentException JavaScript?

Objective Throw InvalidArgumentException in a JavaScript method like one does in Java or similar languages. Background I have been trying …

javascript exception error-handling throw
How do you throw Lua error up?

Is it possible to throw a Lua error from a function to be handled by the script calling the function? …

error-handling lua throw
What does a single "throw;" statement do?

These days, I have been reading a lot the C++ F.A.Q and especially this page. Reading through the …

c++ exception throw
Re-throw an exception inside catch block

Can anyone please confirm me if this information is correct or not: In C++, inside catch block we can re-throw …

c++ exception throw
C#: does 'throw' exit the current function?

If there is a throw statement in the middle of a function, does the function terminate at this point?

c# exception-handling throw