I have read some code and here are two ways to check and log the error in cpp code that repeats in my project many times. Which way is better?
1.
bool AClass::myMethod()
{
if (!SomeCondition())
{
Warning("AClass::myMethod: your description");
return false;
}
doSomthing();
return true;
}
2.
bool AClass::myMethod()
{
if (SomeCondition())
{
doSomething();
}
else
{
Warning("AClass::myMethod: your description");
return false;
}
return true;
}