ObEngine icon indicating copy to clipboard operation
ObEngine copied to clipboard

No error message on EventGroup::trigger when using invalid event name

Open Sygmei opened this issue 3 years ago • 1 comments

CustomGroup:trigger("invalid_name", { test = 3 })

Shows

 "invalid map<K, T> key"

without a meaningful error

Sygmei avatar Dec 16 '21 01:12 Sygmei

This error could be fixed around here : https://github.com/ObEngine/ObEngine/blob/1551bb50e412f7fa79213f1edfb9e002a7e52235/include/Core/Event/EventGroup.hpp#L239 And here as well : https://github.com/ObEngine/ObEngine/blob/1551bb50e412f7fa79213f1edfb9e002a7e52235/include/Core/Event/EventGroup.hpp#L203

Instead of blindly accessing the hashmap, we would check whether the key exists or not and throw a custom exception : https://github.com/ObEngine/ObEngine/blob/1551bb50e412f7fa79213f1edfb9e002a7e52235/include/Core/Event/Exceptions.hpp#L38

Sygmei avatar Mar 23 '22 21:03 Sygmei