make parsing error messages while assets loading more verbose
This commit is contained in:
parent
b7751cf053
commit
15b3e4d549
@ -5,6 +5,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "coders/imageio.hpp"
|
#include "coders/imageio.hpp"
|
||||||
|
#include "coders/commons.hpp"
|
||||||
#include "constants.hpp"
|
#include "constants.hpp"
|
||||||
#include "content/Content.hpp"
|
#include "content/Content.hpp"
|
||||||
#include "content/ContentPack.hpp"
|
#include "content/ContentPack.hpp"
|
||||||
@ -71,20 +72,26 @@ aloader_func AssetsLoader::getLoader(AssetType tag) {
|
|||||||
void AssetsLoader::loadNext() {
|
void AssetsLoader::loadNext() {
|
||||||
const aloader_entry& entry = entries.front();
|
const aloader_entry& entry = entries.front();
|
||||||
logger.info() << "loading " << entry.filename << " as " << entry.alias;
|
logger.info() << "loading " << entry.filename << " as " << entry.alias;
|
||||||
|
|
||||||
|
std::string error {};
|
||||||
try {
|
try {
|
||||||
aloader_func loader = getLoader(entry.tag);
|
aloader_func loader = getLoader(entry.tag);
|
||||||
auto postfunc =
|
auto postfunc =
|
||||||
loader(this, paths, entry.filename, entry.alias, entry.config);
|
loader(this, paths, entry.filename, entry.alias, entry.config);
|
||||||
postfunc(&assets);
|
postfunc(&assets);
|
||||||
entries.pop();
|
} catch (const parsing_error& err) {
|
||||||
} catch (std::runtime_error& err) {
|
error = err.errorLog();
|
||||||
logger.error() << err.what();
|
} catch (const std::runtime_error& err) {
|
||||||
auto type = entry.tag;
|
error = err.what();
|
||||||
std::string filename = entry.filename;
|
|
||||||
std::string reason = err.what();
|
|
||||||
entries.pop();
|
|
||||||
throw assetload::error(type, std::move(filename), std::move(reason));
|
|
||||||
}
|
}
|
||||||
|
if (!error.empty()) {
|
||||||
|
logger.error() << error;
|
||||||
|
auto tag = entry.tag;
|
||||||
|
auto filename = entry.filename;
|
||||||
|
entries.pop();
|
||||||
|
throw assetload::error(tag, std::move(filename), std::move(error));
|
||||||
|
}
|
||||||
|
entries.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_layouts(
|
static void add_layouts(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user