mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Catch some more file-opening exceptions and make them lua errors instead
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user