Skip to content

Commit

Permalink
fixed bug in client dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorier committed Feb 5, 2024
1 parent 1850943 commit a4d88ca
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
15 changes: 10 additions & 5 deletions examples/module-b.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ class ServiceBFactory : public bedrock::AbstractServiceFactory {
public:

ServiceBFactory() {
m_provider_dependencies.push_back({ "ssg_group", "ssg", BEDROCK_REQUIRED });
m_provider_dependencies.push_back({ "mona_instance", "mona", BEDROCK_REQUIRED });
m_provider_dependencies.push_back({ "a_provider", "module_a", BEDROCK_REQUIRED });
m_provider_dependencies.push_back({ "a_local", "module_a", BEDROCK_REQUIRED | BEDROCK_ARRAY});
m_provider_dependencies.push_back({ "a_client", "module_a", BEDROCK_REQUIRED });
m_provider_dependencies.push_back({
"ssg_group", "ssg", BEDROCK_REQUIRED });
m_provider_dependencies.push_back({
"mona_instance", "mona", BEDROCK_REQUIRED });
m_provider_dependencies.push_back({
"a_provider", "module_a", BEDROCK_REQUIRED | BEDROCK_KIND_PROVIDER});
m_provider_dependencies.push_back({
"a_provider_handle", "module_a", BEDROCK_REQUIRED | BEDROCK_ARRAY | BEDROCK_KIND_PROVIDER_HANDLE});
m_provider_dependencies.push_back({
"a_client", "module_a", BEDROCK_REQUIRED | BEDROCK_KIND_CLIENT});
}

void* registerProvider(const bedrock::FactoryArgs& args) override {
Expand Down
2 changes: 1 addition & 1 deletion include/bedrock/AbstractServiceFactory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ class AbstractServiceFactory {
*/
virtual std::vector<Dependency> getClientDependencies(const char* config) {
(void)config;
return getProviderDependencies();
return getClientDependencies();
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/ClientManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ ClientManager::addClientFromJSON(const std::string& jsonString) {
}
}
} else if (dependency.flags & BEDROCK_REQUIRED) {
throw DETAILED_EXCEPTION("Missing dependency {} in configuration",
dependency.name);
throw DETAILED_EXCEPTION("Missing client dependency \"{}\" of type \"{}\" in configuration",
dependency.name, dependency.type);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ProviderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ ProviderManager::addProviderFromJSON(const std::string& jsonString) {
}
}
} else if (dependency.flags & BEDROCK_REQUIRED) {
throw DETAILED_EXCEPTION("Missing dependency {} in configuration",
dependency.name);
throw DETAILED_EXCEPTION("Missing provider dependency \"{}\" of type \"{}\" in configuration",
dependency.name, dependency.type);
}
}

Expand Down

0 comments on commit a4d88ca

Please sign in to comment.