Catch some more file-opening exceptions and make them lua errors instead

This commit is contained in:
Bart van Strien
2011-02-18 16:10:20 +01:00
parent b337846b2b
commit 453593c9b0
2 changed files with 14 additions and 2 deletions
@@ -218,7 +218,12 @@ namespace physfs
int w_load(lua_State * L)
{
return instance->load(L);
try {
return instance->load(L);
}
catch (love::Exception & e) {
return luaL_error(L, e.what());
}
}
int w_getLastModified(lua_State * L)
+8 -1
View File
@@ -286,7 +286,14 @@ namespace sdl
if (lua_isstring(L, 2))
luax_convobj(L, 2, "filesystem", "newFile");
if (luax_istype(L, 2, FILESYSTEM_FILE_T))
data = luax_checktype<love::filesystem::File>(L, 2, "File", FILESYSTEM_FILE_T)->read();
{
Data * d;
try {
data = luax_checktype<love::filesystem::File>(L, 2, "File", FILESYSTEM_FILE_T)->read();
} catch (love::Exception & e) {
return luaL_error(L, e.what());
}
}
else
data = luax_checktype<love::Data>(L, 2, "Data", DATA_T);
Thread *t = instance->newThread(name, data);