{Filter,Highlighter}Registry: more infos on factory not found
This commit is contained in:
parent
0b4ed2280f
commit
11d606f79e
|
@ -8,7 +8,8 @@ namespace Kakoune
|
||||||
|
|
||||||
struct factory_not_found : public runtime_error
|
struct factory_not_found : public runtime_error
|
||||||
{
|
{
|
||||||
factory_not_found() : runtime_error("filter factory not found") {}
|
factory_not_found(const std::string& name)
|
||||||
|
: runtime_error("filter factory not found '" + name + "'") {}
|
||||||
};
|
};
|
||||||
|
|
||||||
void FilterRegistry::register_factory(const std::string& name,
|
void FilterRegistry::register_factory(const std::string& name,
|
||||||
|
@ -24,7 +25,7 @@ void FilterRegistry::add_filter_to_buffer(Buffer& buffer,
|
||||||
{
|
{
|
||||||
auto it = m_factories.find(name);
|
auto it = m_factories.find(name);
|
||||||
if (it == m_factories.end())
|
if (it == m_factories.end())
|
||||||
throw factory_not_found();
|
throw factory_not_found(name);
|
||||||
|
|
||||||
buffer.add_filter(it->second(buffer, parameters));
|
buffer.add_filter(it->second(buffer, parameters));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ namespace Kakoune
|
||||||
|
|
||||||
struct factory_not_found : public runtime_error
|
struct factory_not_found : public runtime_error
|
||||||
{
|
{
|
||||||
factory_not_found() : runtime_error("factory not found") {}
|
factory_not_found(const std::string& name)
|
||||||
|
: runtime_error("highlighter factory not found '" + name + "'") {}
|
||||||
};
|
};
|
||||||
|
|
||||||
void HighlighterRegistry::register_factory(const std::string& name,
|
void HighlighterRegistry::register_factory(const std::string& name,
|
||||||
|
@ -24,7 +25,7 @@ void HighlighterRegistry::add_highlighter_to_window(Window& window,
|
||||||
{
|
{
|
||||||
auto it = m_factories.find(name);
|
auto it = m_factories.find(name);
|
||||||
if (it == m_factories.end())
|
if (it == m_factories.end())
|
||||||
throw factory_not_found();
|
throw factory_not_found(name);
|
||||||
|
|
||||||
window.add_highlighter(it->second(window, parameters));
|
window.add_highlighter(it->second(window, parameters));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user