|
@@ -3,7 +3,7 @@
|
|
|
* Company: Lynar Studios
|
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
|
* Created: 2020-11-27
|
|
|
- * Changed: 2023-02-04
|
|
|
+ * Changed: 2023-02-07
|
|
|
*
|
|
|
* */
|
|
|
|
|
@@ -19,9 +19,14 @@ ls::std::event::EventManager::~EventManager() = default;
|
|
|
|
|
|
void ls::std::event::EventManager::subscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
|
|
|
{
|
|
|
- if (_id.empty() || _listener == nullptr)
|
|
|
+ if (_id.empty())
|
|
|
+ {
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_id is empty"};
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_listener == nullptr)
|
|
|
{
|
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_listener is null"};
|
|
|
}
|
|
|
|
|
|
if (this->_hasEventHandler(_id))
|
|
@@ -30,15 +35,20 @@ void ls::std::event::EventManager::subscribe(const ls::std::core::type::event_id
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- throw ls::std::core::EventNotSubscribedException{};
|
|
|
+ throw ls::std::core::EventNotSubscribedException{"id: " + _id};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void ls::std::event::EventManager::unsubscribe(const ls::std::core::type::event_id &_id, const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
|
|
|
{
|
|
|
- if (_id.empty() || _listener == nullptr)
|
|
|
+ if (_id.empty())
|
|
|
+ {
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_id is empty"};
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_listener == nullptr)
|
|
|
{
|
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_listener is null"};
|
|
|
}
|
|
|
|
|
|
if (this->_hasEventHandler(_id))
|
|
@@ -53,7 +63,7 @@ bool ls::std::event::EventManager::addEventHandler(const ::std::shared_ptr<ls::s
|
|
|
|
|
|
if (_eventHandler == nullptr)
|
|
|
{
|
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_eventHandler is null"};
|
|
|
}
|
|
|
|
|
|
if (!this->_hasEventHandler(_eventHandler->getId()))
|
|
@@ -73,7 +83,7 @@ void ls::std::event::EventManager::fire(ls::std::event::Event _event)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- throw ls::std::core::EventNotHandledException{};
|
|
|
+ throw ls::std::core::EventNotHandledException{"id: " + _event.getId()};
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -81,7 +91,7 @@ bool ls::std::event::EventManager::hasEventHandler(const ls::std::core::type::ev
|
|
|
{
|
|
|
if (_id.empty())
|
|
|
{
|
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_id is empty"};
|
|
|
}
|
|
|
|
|
|
return this->_hasEventHandler(_id);
|
|
@@ -91,7 +101,7 @@ bool ls::std::event::EventManager::removeEventHandler(const ::std::shared_ptr<ls
|
|
|
{
|
|
|
if (_eventHandler == nullptr)
|
|
|
{
|
|
|
- throw ls::std::core::IllegalArgumentException{};
|
|
|
+ throw ls::std::core::IllegalArgumentException{"_eventHandler is null"};
|
|
|
}
|
|
|
|
|
|
return this->_removeEventHandler(_eventHandler);
|