diff --git a/yasmin/include/yasmin/blackboard/blackboard.hpp b/yasmin/include/yasmin/blackboard/blackboard.hpp index 8e3c6c8..26dd0bb 100644 --- a/yasmin/include/yasmin/blackboard/blackboard.hpp +++ b/yasmin/include/yasmin/blackboard/blackboard.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "yasmin/blackboard/blackboard_value.hpp" #include "yasmin/blackboard/blackboard_value_interface.hpp" @@ -42,7 +43,7 @@ class Blackboard { std::lock_guard lk(this->mutex); if (!this->contains(name)) { - throw "Element " + name + " does not exist in the blackboard"; + throw std::runtime_error("Element " + name + " does not exist in the blackboard"); } BlackboardValue *b_value = (BlackboardValue *)this->values.at(name); diff --git a/yasmin/src/yasmin/state.cpp b/yasmin/src/yasmin/state.cpp index 038a8cd..65d8715 100644 --- a/yasmin/src/yasmin/state.cpp +++ b/yasmin/src/yasmin/state.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include "yasmin/state.hpp" @@ -30,7 +31,7 @@ State::operator()(std::shared_ptr blackboard) { if (std::find(this->outcomes.begin(), this->outcomes.end(), outcome) == this->outcomes.end()) { - throw "Outcome (" + outcome + ") does not exist"; + throw std::logic_error("Outcome (" + outcome + ") does not exist"); } return outcome; diff --git a/yasmin/src/yasmin/state_machine.cpp b/yasmin/src/yasmin/state_machine.cpp index 46eb369..d50d696 100644 --- a/yasmin/src/yasmin/state_machine.cpp +++ b/yasmin/src/yasmin/state_machine.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -101,8 +101,8 @@ StateMachine::execute(std::shared_ptr blackboard) { // check outcome belongs to state if (std::find(state->get_outcomes().begin(), state->get_outcomes().end(), outcome) == this->outcomes.end()) { - throw "Outcome (" + outcome + ") is not register in state " + - this->current_state; + throw std::logic_error("Outcome (" + outcome + ") is not register in state " + + this->current_state); } // translate outcome using transitions @@ -133,7 +133,7 @@ StateMachine::execute(std::shared_ptr blackboard) { // outcome is not in the sm } else { - throw "Outcome (" + outcome + ") without transition"; + throw std::logic_error("Outcome (" + outcome + ") without transition"); } }