Made use of POLYVOX_THROW where appropriate.

This commit is contained in:
David Williams 2012-12-29 23:29:28 +01:00
parent 0c78d97ba5
commit d5b03cdbc3
5 changed files with 18 additions and 8 deletions

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution. distribution.
*******************************************************************************/ *******************************************************************************/
#include "PolyVoxCore/Impl/ErrorHandling.h"
namespace PolyVox namespace PolyVox
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -159,7 +161,7 @@ namespace PolyVox
if((openNodes.empty()) || (openNodes.getFirst() != endNode)) if((openNodes.empty()) || (openNodes.getFirst() != endNode))
{ {
//In this case we failed to find a valid path. //In this case we failed to find a valid path.
throw std::runtime_error("No path found"); POLYVOX_THROW(std::runtime_error, "No path found");
} }
else else
{ {

View File

@ -21,7 +21,9 @@ freely, subject to the following restrictions:
distribution. distribution.
*******************************************************************************/ *******************************************************************************/
#include "PolyVoxCore/Impl/ErrorHandling.h"
#include "PolyVoxCore/Impl/Utility.h" #include "PolyVoxCore/Impl/Utility.h"
#include "PolyVoxCore/Vector.h" #include "PolyVoxCore/Vector.h"
#include <cassert> #include <cassert>
@ -130,7 +132,7 @@ namespace PolyVox
//Release mode validation //Release mode validation
if(!isPowerOf2(uSideLength)) if(!isPowerOf2(uSideLength))
{ {
throw std::invalid_argument("Block side length must be a power of two."); POLYVOX_THROW(std::invalid_argument, "Block side length must be a power of two.");
} }
//Compute the side length //Compute the side length

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution. distribution.
*******************************************************************************/ *******************************************************************************/
#include "PolyVoxCore/Impl/ErrorHandling.h"
//Included here rather than in the .h because it refers to LargeVolume (avoids forward declaration) //Included here rather than in the .h because it refers to LargeVolume (avoids forward declaration)
#include "PolyVoxCore/ConstVolumeProxy.h" #include "PolyVoxCore/ConstVolumeProxy.h"
@ -471,11 +473,11 @@ namespace PolyVox
//Release mode validation //Release mode validation
if(uBlockSideLength == 0) if(uBlockSideLength == 0)
{ {
throw std::invalid_argument("Block side length cannot be zero."); POLYVOX_THROW(std::invalid_argument, "Block side length cannot be zero.");
} }
if(!isPowerOf2(uBlockSideLength)) if(!isPowerOf2(uBlockSideLength))
{ {
throw std::invalid_argument("Block side length must be a power of two."); POLYVOX_THROW(std::invalid_argument, "Block side length must be a power of two.");
} }
m_uTimestamper = 0; m_uTimestamper = 0;

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution. distribution.
*******************************************************************************/ *******************************************************************************/
#include "PolyVoxCore/Impl/ErrorHandling.h"
namespace PolyVox namespace PolyVox
{ {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -253,15 +255,15 @@ namespace PolyVox
//Release mode validation //Release mode validation
if(uBlockSideLength < 8) if(uBlockSideLength < 8)
{ {
throw std::invalid_argument("Block side length should be at least 8"); POLYVOX_THROW(std::invalid_argument, "Block side length should be at least 8");
} }
if(uBlockSideLength > 256) if(uBlockSideLength > 256)
{ {
throw std::invalid_argument("Block side length should not be more than 256"); POLYVOX_THROW(std::invalid_argument, "Block side length should not be more than 256");
} }
if(!isPowerOf2(uBlockSideLength)) if(!isPowerOf2(uBlockSideLength))
{ {
throw std::invalid_argument("Block side length must be a power of two."); POLYVOX_THROW(std::invalid_argument, "Block side length must be a power of two.");
} }
this->m_regValidRegion = regValidRegion; this->m_regValidRegion = regValidRegion;

View File

@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution. distribution.
*******************************************************************************/ *******************************************************************************/
#include "PolyVoxCore/Impl/ErrorHandling.h"
namespace PolyVox namespace PolyVox
{ {
template <typename VoxelType> template <typename VoxelType>
@ -109,7 +111,7 @@ namespace PolyVox
//Release mode validation //Release mode validation
if(!isPowerOf2(uSideLength)) if(!isPowerOf2(uSideLength))
{ {
throw std::invalid_argument("Block side length must be a power of two."); POLYVOX_THROW(std::invalid_argument, "Block side length must be a power of two.");
} }
//Compute the side length //Compute the side length