int somefunction(bool a)
{
try
{
if(a)
throw Error("msg");
return 2;
}
catch (Error const & error)
{
//do i need to return anything here??
//return -1;
}
}
int somefunction(bool a) { try { if(a) throw Error(msg); return 2; } catch (Error
Share
You need to either return something or re-throw the exception (or throw a new one). You can rethrow the same exception by just using the keyword
in the catch block with no exception or arguments afterwards.