mirror of
https://github.com/love2d/love.git
synced 2026-08-19 04:06:17 +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)
|
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)
|
int w_getLastModified(lua_State * L)
|
||||||
|
|||||||
@@ -286,7 +286,14 @@ namespace sdl
|
|||||||
if (lua_isstring(L, 2))
|
if (lua_isstring(L, 2))
|
||||||
luax_convobj(L, 2, "filesystem", "newFile");
|
luax_convobj(L, 2, "filesystem", "newFile");
|
||||||
if (luax_istype(L, 2, FILESYSTEM_FILE_T))
|
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
|
else
|
||||||
data = luax_checktype<love::Data>(L, 2, "Data", DATA_T);
|
data = luax_checktype<love::Data>(L, 2, "Data", DATA_T);
|
||||||
Thread *t = instance->newThread(name, data);
|
Thread *t = instance->newThread(name, data);
|
||||||
|
|||||||
Reference in New Issue
Block a user