Skip to content

Commit

Permalink
BugFix: Replace occurences of throw with THROW
Browse files Browse the repository at this point in the history
This was causing location to not be reported by certain exceptions.
  • Loading branch information
Robadob committed Jul 28, 2023
1 parent f151c83 commit e1caa79
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions include/flamegpu/simulation/RunPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void RunPlan::setProperty(const std::string &name, const flamegpu::size_type ind
}
const unsigned int t_index = detail::type_decode<T>::len_t * index + detail::type_decode<T>::len_t;
if (it->second.data.elements < t_index || t_index < index) {
throw exception::OutOfBoundsException("Environment property array index out of bounds "
THROW exception::OutOfBoundsException("Environment property array index out of bounds "
"in RunPlan::setProperty()\n");
}
// Check whether array already exists in property overrides
Expand Down Expand Up @@ -383,7 +383,7 @@ T RunPlan::getProperty(const std::string &name, const flamegpu::size_type index)
}
const unsigned int t_index = detail::type_decode<T>::len_t * index + detail::type_decode<T>::len_t;
if (it->second.data.elements < t_index || t_index < index) {
throw exception::OutOfBoundsException("Environment property array index out of bounds "
THROW exception::OutOfBoundsException("Environment property array index out of bounds "
"in RunPlan::getProperty()\n");
}
// Check whether property already exists in property overrides
Expand Down
6 changes: 3 additions & 3 deletions include/flamegpu/simulation/RunPlanVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void RunPlanVector::setProperty(const std::string &name, const flamegpu::size_ty
}
const unsigned int t_index = detail::type_decode<T>::len_t * index + detail::type_decode<T>::len_t;
if (t_index > it->second.data.elements || t_index < index) {
throw exception::OutOfBoundsException("Environment property array index out of bounds "
THROW exception::OutOfBoundsException("Environment property array index out of bounds "
"in RunPlanVector::setProperty()\n");
}
for (auto &i : *this) {
Expand Down Expand Up @@ -457,7 +457,7 @@ void RunPlanVector::setPropertyLerpRange(const std::string &name, const flamegpu
}
const unsigned int t_index = detail::type_decode<T>::len_t * index + detail::type_decode<T>::len_t;
if (t_index > it->second.data.elements || t_index < index) {
throw exception::OutOfBoundsException("Environment property array index out of bounds "
THROW exception::OutOfBoundsException("Environment property array index out of bounds "
"in RunPlanVector::setPropertyLerpRange()\n");
}
unsigned int ct = 0;
Expand Down Expand Up @@ -518,7 +518,7 @@ void RunPlanVector::setPropertyRandom(const std::string &name, const flamegpu::s
}
const unsigned int t_index = detail::type_decode<T>::len_t * index + detail::type_decode<T>::len_t;
if (t_index > it->second.data.elements || t_index < index) {
throw exception::OutOfBoundsException("Environment property array index out of bounds "
THROW exception::OutOfBoundsException("Environment property array index out of bounds "
"in RunPlanVector::setPropertyRandom()\n");
}
for (auto &i : *this) {
Expand Down
24 changes: 12 additions & 12 deletions src/flamegpu/io/XMLLogger.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ namespace io {
switch (a_eResult) { \
case tinyxml2::XML_ERROR_FILE_NOT_FOUND : \
case tinyxml2::XML_ERROR_FILE_COULD_NOT_BE_OPENED : \
throw exception::InvalidInputFile("TinyXML error: File could not be opened.\n Error code: %d", a_eResult); \
THROW exception::InvalidInputFile("TinyXML error: File could not be opened.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_FILE_READ_ERROR : \
throw exception::InvalidInputFile("TinyXML error: File could not be read.\n Error code: %d", a_eResult); \
THROW exception::InvalidInputFile("TinyXML error: File could not be read.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_PARSING_ELEMENT : \
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE : \
case tinyxml2::XML_ERROR_PARSING_TEXT : \
Expand All @@ -26,25 +26,25 @@ namespace io {
case tinyxml2::XML_ERROR_PARSING_DECLARATION : \
case tinyxml2::XML_ERROR_PARSING_UNKNOWN : \
case tinyxml2::XML_ERROR_PARSING : \
throw exception::TinyXMLError("TinyXML error: Error parsing file.\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: Error parsing file.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_EMPTY_DOCUMENT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_EMPTY_DOCUMENT\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_MISMATCHED_ELEMENT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_MISMATCHED_ELEMENT\n Error code: %d", a_eResult); \
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT : \
throw exception::TinyXMLError("TinyXML error: XML_CAN_NOT_CONVERT_TEXT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_CAN_NOT_CONVERT_TEXT\n Error code: %d", a_eResult); \
case tinyxml2::XML_NO_TEXT_NODE : \
throw exception::TinyXMLError("TinyXML error: XML_NO_TEXT_NODE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_NO_TEXT_NODE\n Error code: %d", a_eResult); \
case tinyxml2::XML_ELEMENT_DEPTH_EXCEEDED : \
throw exception::TinyXMLError("TinyXML error: XML_ELEMENT_DEPTH_EXCEEDED\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ELEMENT_DEPTH_EXCEEDED\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_COUNT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_COUNT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_COUNT\n Error code: %d", a_eResult); \
case tinyxml2::XML_NO_ATTRIBUTE: \
throw exception::TinyXMLError("TinyXML error: XML_NO_ATTRIBUTE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_NO_ATTRIBUTE\n Error code: %d", a_eResult); \
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE : \
throw exception::TinyXMLError("TinyXML error: XML_WRONG_ATTRIBUTE_TYPE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_WRONG_ATTRIBUTE_TYPE\n Error code: %d", a_eResult); \
default: \
throw exception::TinyXMLError("TinyXML error: Unrecognised error code\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: Unrecognised error code\n Error code: %d", a_eResult); \
} \
}
#endif
Expand Down
24 changes: 12 additions & 12 deletions src/flamegpu/io/XMLStateReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace io {
switch (a_eResult) { \
case tinyxml2::XML_ERROR_FILE_NOT_FOUND : \
case tinyxml2::XML_ERROR_FILE_COULD_NOT_BE_OPENED : \
throw exception::InvalidInputFile("TinyXML error: File could not be opened.\n Error code: %d", a_eResult); \
THROW exception::InvalidInputFile("TinyXML error: File could not be opened.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_FILE_READ_ERROR : \
throw exception::InvalidInputFile("TinyXML error: File could not be read.\n Error code: %d", a_eResult); \
THROW exception::InvalidInputFile("TinyXML error: File could not be read.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_PARSING_ELEMENT : \
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE : \
case tinyxml2::XML_ERROR_PARSING_TEXT : \
Expand All @@ -41,25 +41,25 @@ namespace io {
case tinyxml2::XML_ERROR_PARSING_DECLARATION : \
case tinyxml2::XML_ERROR_PARSING_UNKNOWN : \
case tinyxml2::XML_ERROR_PARSING : \
throw exception::TinyXMLError("TinyXML error: Error parsing file.\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: Error parsing file.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_EMPTY_DOCUMENT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_EMPTY_DOCUMENT\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_MISMATCHED_ELEMENT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_MISMATCHED_ELEMENT\n Error code: %d", a_eResult); \
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT : \
throw exception::TinyXMLError("TinyXML error: XML_CAN_NOT_CONVERT_TEXT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_CAN_NOT_CONVERT_TEXT\n Error code: %d", a_eResult); \
case tinyxml2::XML_NO_TEXT_NODE : \
throw exception::TinyXMLError("TinyXML error: XML_NO_TEXT_NODE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_NO_TEXT_NODE\n Error code: %d", a_eResult); \
case tinyxml2::XML_ELEMENT_DEPTH_EXCEEDED : \
throw exception::TinyXMLError("TinyXML error: XML_ELEMENT_DEPTH_EXCEEDED\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ELEMENT_DEPTH_EXCEEDED\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_COUNT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_COUNT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_COUNT\n Error code: %d", a_eResult); \
case tinyxml2::XML_NO_ATTRIBUTE: \
throw exception::TinyXMLError("TinyXML error: XML_NO_ATTRIBUTE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_NO_ATTRIBUTE\n Error code: %d", a_eResult); \
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE : \
throw exception::TinyXMLError("TinyXML error: XML_WRONG_ATTRIBUTE_TYPE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_WRONG_ATTRIBUTE_TYPE\n Error code: %d", a_eResult); \
default: \
throw exception::TinyXMLError("TinyXML error: Unrecognised error code\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: Unrecognised error code\n Error code: %d", a_eResult); \
} \
}
#endif
Expand Down
24 changes: 12 additions & 12 deletions src/flamegpu/io/XMLStateWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace io {
switch (a_eResult) { \
case tinyxml2::XML_ERROR_FILE_NOT_FOUND : \
case tinyxml2::XML_ERROR_FILE_COULD_NOT_BE_OPENED : \
throw exception::InvalidInputFile("TinyXML error: File could not be opened.\n Error code: %d", a_eResult); \
THROW exception::InvalidInputFile("TinyXML error: File could not be opened.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_FILE_READ_ERROR : \
throw exception::InvalidInputFile("TinyXML error: File could not be read.\n Error code: %d", a_eResult); \
THROW exception::InvalidInputFile("TinyXML error: File could not be read.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_PARSING_ELEMENT : \
case tinyxml2::XML_ERROR_PARSING_ATTRIBUTE : \
case tinyxml2::XML_ERROR_PARSING_TEXT : \
Expand All @@ -39,25 +39,25 @@ namespace io {
case tinyxml2::XML_ERROR_PARSING_DECLARATION : \
case tinyxml2::XML_ERROR_PARSING_UNKNOWN : \
case tinyxml2::XML_ERROR_PARSING : \
throw exception::TinyXMLError("TinyXML error: Error parsing file.\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: Error parsing file.\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_EMPTY_DOCUMENT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_EMPTY_DOCUMENT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_EMPTY_DOCUMENT\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_MISMATCHED_ELEMENT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_MISMATCHED_ELEMENT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_MISMATCHED_ELEMENT\n Error code: %d", a_eResult); \
case tinyxml2::XML_CAN_NOT_CONVERT_TEXT : \
throw exception::TinyXMLError("TinyXML error: XML_CAN_NOT_CONVERT_TEXT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_CAN_NOT_CONVERT_TEXT\n Error code: %d", a_eResult); \
case tinyxml2::XML_NO_TEXT_NODE : \
throw exception::TinyXMLError("TinyXML error: XML_NO_TEXT_NODE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_NO_TEXT_NODE\n Error code: %d", a_eResult); \
case tinyxml2::XML_ELEMENT_DEPTH_EXCEEDED : \
throw exception::TinyXMLError("TinyXML error: XML_ELEMENT_DEPTH_EXCEEDED\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ELEMENT_DEPTH_EXCEEDED\n Error code: %d", a_eResult); \
case tinyxml2::XML_ERROR_COUNT : \
throw exception::TinyXMLError("TinyXML error: XML_ERROR_COUNT\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_ERROR_COUNT\n Error code: %d", a_eResult); \
case tinyxml2::XML_NO_ATTRIBUTE: \
throw exception::TinyXMLError("TinyXML error: XML_NO_ATTRIBUTE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_NO_ATTRIBUTE\n Error code: %d", a_eResult); \
case tinyxml2::XML_WRONG_ATTRIBUTE_TYPE : \
throw exception::TinyXMLError("TinyXML error: XML_WRONG_ATTRIBUTE_TYPE\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: XML_WRONG_ATTRIBUTE_TYPE\n Error code: %d", a_eResult); \
default: \
throw exception::TinyXMLError("TinyXML error: Unrecognised error code\n Error code: %d", a_eResult); \
THROW exception::TinyXMLError("TinyXML error: Unrecognised error code\n Error code: %d", a_eResult); \
} \
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/flamegpu/simulation/RunPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void RunPlan::setRandomSimulationSeed(const uint64_t _random_seed) {
}
void RunPlan::setSteps(const unsigned int _steps) {
if (_steps == 0 && !allow_0_steps) {
throw exception::OutOfBoundsException("Model description requires atleast 1 exit condition to have unlimited steps, "
THROW exception::OutOfBoundsException("Model description requires atleast 1 exit condition to have unlimited steps, "
"in RunPlan::setSteps()");
}
steps = _steps;
Expand Down
2 changes: 1 addition & 1 deletion src/flamegpu/simulation/RunPlanVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void RunPlanVector::setRandomSimulationSeed(const uint64_t initial_seed, const u
}
void RunPlanVector::setSteps(const unsigned int steps) {
if (steps == 0 && !allow_0_steps) {
throw exception::OutOfBoundsException("Model description requires atleast 1 exit condition to have unlimited steps, "
THROW exception::OutOfBoundsException("Model description requires atleast 1 exit condition to have unlimited steps, "
"in RunPlanVector::setSteps()");
}
for (auto &i : *this) {
Expand Down

0 comments on commit e1caa79

Please sign in to comment.