Skip to content

Commit

Permalink
Fixed bad TextureNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
Sygmei committed Jun 14, 2020
1 parent ece9ddb commit 220f76a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/Core/Engine/Exceptions.hpp
Expand Up @@ -50,7 +50,7 @@ namespace obe::Engine::Exceptions
std::string_view path, std::vector<std::string> mounts, DebugInfo info)
: Exception("TextureNotFound", info)
{
this->error("Could not find Texture with path '{}'");
this->error("Could not find Texture with path '{}'", path);
this->hint("The following paths were used to search for the Texture ({})",
fmt::join(mounts, ", "));
}
Expand Down
2 changes: 1 addition & 1 deletion include/Core/Scene/Scene.hpp
Expand Up @@ -20,7 +20,7 @@ namespace obe

namespace obe::Scene
{
using OnSceneLoadCallback = std::function<void(const std::string&)>;
using OnSceneLoadCallback = sol::protected_function;

/**
* \brief The Scene class is a container of all the game elements
Expand Down
1 change: 1 addition & 0 deletions include/Core/Triggers/TriggerGroup.hpp
Expand Up @@ -31,6 +31,7 @@ namespace obe::Triggers
explicit TriggerGroup(sol::state_view lua,
const std::string& triggerGroupNamespace,
const std::string& triggerGroupName);
~TriggerGroup();
/**
* \brief Sets if the TriggerGroup is joinable or not
* \param joinable true if the TriggerGroup should be joinable, false
Expand Down
13 changes: 7 additions & 6 deletions src/Core/Scene/Scene.cpp
Expand Up @@ -366,14 +366,15 @@ namespace obe::Scene
this->loadFromFile(futureLoadBuffer);
if (m_onLoadCallback)
{
try
{
m_onLoadCallback(futureLoadBuffer);
}
catch (std::exception& e)
sol::protected_function_result result
= m_onLoadCallback(futureLoadBuffer);
if (!result.valid())
{
const auto error = result.get<sol::error>();
const std::string errMsg = "\n \""
+ Utils::String::replace(error.what(), "\n", "\n ") + "\"";
throw Exceptions::SceneOnLoadCallbackError(
currentScene, futureLoadBuffer, e.what(), EXC_INFO);
currentScene, futureLoadBuffer, errMsg, EXC_INFO);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/Core/Triggers/TriggerGroup.cpp
Expand Up @@ -13,6 +13,12 @@ namespace obe::Triggers
m_name = triggerGroupName;
}

TriggerGroup::~TriggerGroup()
{
Debug::Log->trace(
"<TriggerGroup> Deleting TriggerGroup '{}.{}'", m_fromNsp, m_name);
}

std::weak_ptr<Trigger> TriggerGroup::get(const std::string& triggerName)
{
if (m_triggerMap.find(triggerName) != m_triggerMap.end())
Expand Down
5 changes: 3 additions & 2 deletions src/Core/Triggers/TriggerManager.cpp
Expand Up @@ -100,11 +100,12 @@ namespace obe::Triggers
void TriggerManager::removeNamespace(const std::string& space)
{
Debug::Log->debug("<TriggerManager> Removing Trigger Namespace {0}", space);
if (m_allTriggers.find(space) != m_allTriggers.end())
if (const auto spaceItr = m_allTriggers.find(space);
spaceItr != m_allTriggers.end())
{
Debug::Log->trace(
"<TriggerManager> Found Trigger Namespace {0}, removing it...", space);
m_allTriggers.erase(m_allTriggers.find(space));
m_allTriggers.erase(spaceItr);
return;
}
std::vector<std::string> namespaces(m_allTriggers.size());
Expand Down

0 comments on commit 220f76a

Please sign in to comment.