Skip to content

Commit

Permalink
fix: Format
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Sep 16, 2024
1 parent eac70d2 commit aa50e9a
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,26 @@ std::shared_ptr<HybridObject> HybridObjectRegistry::createHybridObject(const std
auto fn = map.find(hybridObjectName);
if (fn == map.end()) [[unlikely]] {
auto message = "Cannot create an instance of HybridObject \"" + std::string(hybridObjectName) +
"\" - "
"It has not yet been registered in the Nitro Modules HybridObjectRegistry!";
"\" - It has not yet been registered in the Nitro Modules HybridObjectRegistry! Suggestions:\n"
"- If you use Nitrogen, make sure your `nitro.json` contains `" +
std::string(hybridObjectName) +
"` on this platform.\n"
"- If you use Nitrogen, make sure your library (*Package.java)/app (MainApplication.java) calls "
"`System.loadLibrary(\"<<androidCxxLibName>>\")` somewhere on app-startup.\n"
"- If you use Nitrogen, make sure your cpp-adapter.cpp calls `margelo::nitro::<<cxxNamespace>>::initialize(vm)`.\n"
"- If you don't use Nitrogen, make sure you called `HybridObjectRegistry.registerHybridObject(...)`.\n";
throw std::runtime_error(message);
}
std::shared_ptr<HybridObject> instance = fn->second();

#ifdef NITRO_DEBUG
if (instance == nullptr) [[unlikely]] {
throw std::runtime_error("Failed to create HybridObject \"" + hybridObjectName +
"\" - "
"The constructor returned a nullptr!");
throw std::runtime_error("Failed to create HybridObject \"" + hybridObjectName + "\" - The constructor returned a nullptr!");
}
if (instance->getName() != hybridObjectName) [[unlikely]] {
throw std::runtime_error("HybridObject's name (\"" + instance->getName() +
"\") does not match"
"the name it was registered with (\"" +
"\") "
"does not match the name it was registered with (\"" +
hybridObjectName + "\")!");
}
#endif
Expand Down

0 comments on commit aa50e9a

Please sign in to comment.