X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fresourcemanager.cpp;fp=source%2Fresourcemanager.cpp;h=733cfaff8c4c37ba5ae1ffbd605ceb3f8d6a58df;hp=e989a5d07b0f5a1d3c2d148257f94694cfc7b08e;hb=da5629982b65a4cbf31abc30a0cf930801fcc940;hpb=918394ff1726a11523fd090b1f92c8657292e0cf diff --git a/source/resourcemanager.cpp b/source/resourcemanager.cpp index e989a5d0..733cfaff 100644 --- a/source/resourcemanager.cpp +++ b/source/resourcemanager.cpp @@ -11,6 +11,10 @@ using namespace std; namespace Msp { namespace GL { +resource_load_error::resource_load_error(const string &name, const string &err): + runtime_error(format("%s: %s", name, err)) +{ } + resource_load_error::resource_load_error(const string &name, const exception &exc): runtime_error(format("%s: %s: %s", name, Debug::demangle(typeid(exc).name()), exc.what())) { } @@ -276,6 +280,9 @@ ResourceManager::ManagedResource::ManagedResource(Resource &r): void ResourceManager::ManagedResource::start_loading() { io = location.collection->open_raw(location.name); + if(!io) + throw resource_load_error(location.name, "open failed"); + loader = resource->load(*io); if(!loader) {