Skip to content

Commit

Permalink
[py] Mute "not a plugin warnings"
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelSchneid3r committed Aug 14, 2023
1 parent 5a2a2fb commit bf8e7d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion python/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ Plugin::Plugin()
for (const QString &plugin_dir : plugin_dirs) {
if (QDir dir{plugin_dir}; dir.cd(PLUGIN_DIR)) {
DEBG << "Searching Python plugins in" << dir.absolutePath();
for (const QFileInfo &file_info : dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)) {
for (const QFileInfo &file_info : dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot)) {
try {
auto &loader = plugins_.emplace_back(make_unique<PyPluginLoader>(*this, file_info));
DEBG << "Found valid Python plugin" << loader->path;
} catch (const NoPluginException &) {
continue;
} catch (const exception &e) {
WARN << e.what() << file_info.filePath();
}
Expand Down
2 changes: 1 addition & 1 deletion python/src/pypluginloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ PyPluginLoader::PyPluginLoader(Plugin &provider, const QFileInfo &file_info)
// Validate metadata

if (metadata_.iid.isEmpty())
throw runtime_error("Not an albert plugin");
throw NoPluginException();


QStringList errors;
Expand Down
2 changes: 2 additions & 0 deletions python/src/pypluginloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class PluginInstance;
class QFileInfo;
class Plugin;

class NoPluginException: public std::exception {};

class PyPluginLoader : public albert::PluginLoader
{
public:
Expand Down

0 comments on commit bf8e7d4

Please sign in to comment.