diff --git a/modules/asset_loader/src/vkcv/asset/asset_loader.cpp b/modules/asset_loader/src/vkcv/asset/asset_loader.cpp index 1c0ac5d2aa98c378cfe8d5e95920a70e0423b201..b5a109203a77bc69456abe8896a0a4cf3a12b3f9 100644 --- a/modules/asset_loader/src/vkcv/asset/asset_loader.cpp +++ b/modules/asset_loader/src/vkcv/asset/asset_loader.cpp @@ -13,6 +13,21 @@ namespace vkcv::asset { +/** + * This function unrolls nested exceptions via recursion and prints them + * @param e error code + * @param path path to file that is responsible for error + */ +void recurseExceptionPrint(const std::exception& e, const std::string &path) +{ + vkcv_log(LogLevel::ERROR, "Loading file %s: %s", path.c_str(), e.what()); + try { + std::rethrow_if_nested(e); + } catch (const std::exception& nested) { + recurseExceptionPrint(nested, path); + } +} + /** * Computes the component count for an accessor type of the fx-gltf library. * @param type The accessor type @@ -34,22 +49,6 @@ uint8_t getCompCount(const fx::gltf::Accessor::Type type) { } } -/** - * This function unrolls nested exceptions via recursion and prints them - * @param e error code - * @param path path to file that is responsible for error - */ -void print_what (const std::exception& e, const std::string &path) { - vkcv_log(LogLevel::ERROR, "Loading file %s: %s", - path.c_str(), e.what()); - - try { - std::rethrow_if_nested(e); - } catch (const std::exception& nested) { - print_what(nested, path); - } -} - /** * Translate the component type used in the index accessor of fx-gltf to our * enum for index type. The reason we have defined an incompatible enum that @@ -194,10 +193,10 @@ int loadScene(const std::string &path, Scene &scene){ sceneObjects = fx::gltf::LoadFromText(path); } } catch (const std::system_error &err) { - print_what(err, path); + recurseExceptionPrint(err, path); return ASSET_ERROR; } catch (const std::exception &e) { - print_what(e, path); + recurseExceptionPrint(e, path); return ASSET_ERROR; } size_t pos = path.find_last_of("/");