| 42 | { |
| 43 | public: |
| 44 | UnknownTrigger(std::string_view triggerNamespace, std::string_view triggerGroup, |
| 45 | std::string_view triggerName, |
| 46 | const std::vector<std::string>& existingTriggers, DebugInfo info) |
| 47 | : Exception("UnknownTrigger", info) |
| 48 | { |
| 49 | this->error("Unable to find a Trigger named '{}' inside TriggerGroup '{}.{}'", |
| 50 | triggerName, triggerNamespace, triggerGroup); |
| 51 | std::vector<std::string> suggestions |
| 52 | = Utils::String::sortByDistance(triggerName.data(), existingTriggers, 5); |
| 53 | std::transform(suggestions.begin(), suggestions.end(), suggestions.begin(), |
| 54 | Utils::String::quote); |
| 55 | this->hint("Try one of the following Triggers ({}...)", |
| 56 | fmt::join(suggestions, ", ")); |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | class UnknownTriggerNamespace : public Exception |