Work on error handling. I replaced some asserts with exceptions and also added basic error handling documentation.

This commit is contained in:
David Williams
2013-05-11 10:05:08 +02:00
parent 62d164ef8a
commit ee299a45f0
22 changed files with 213 additions and 90 deletions

View File

@ -30,10 +30,6 @@ namespace PolyVox
//If this is not the case then the output is undefined.
uint8_t logBase2(uint32_t uInput)
{
//Debug mode validation
POLYVOX_ASSERT(uInput != 0, "Cannot compute the log of zero.");
POLYVOX_ASSERT(isPowerOf2(uInput), "Input must be a power of two in order to compute the log.");
//Release mode validation
if(uInput == 0)
{

View File

@ -78,7 +78,10 @@ namespace PolyVox
*/
void Region::accumulate(const Region& reg)
{
POLYVOX_ASSERT(reg.isValid(), "You cannot accumulate an invalid region."); //The result of accumulating an invalid region is not defined.
if(!reg.isValid())
{
POLYVOX_THROW(invalid_operation, "You cannot accumulate an invalid region."); //The result of accumulating an invalid region is not defined.
}
m_iLowerX = ((std::min)(m_iLowerX, reg.getLowerX()));
m_iLowerY = ((std::min)(m_iLowerY, reg.getLowerY()));