diff --git a/src/app/script/docobj.h b/src/app/script/docobj.h index 8974234dd..2a33acc84 100644 --- a/src/app/script/docobj.h +++ b/src/app/script/docobj.h @@ -41,7 +41,11 @@ template T* check_docobj(lua_State* L, T* obj) { if (obj) return obj; else { - luaL_error(L, "Using a nil '%s' object", get_mtname()); + luaL_traceback(L, L, nullptr, 1); + const char* traceback = lua_tostring(L, -1); + luaL_error(L, "%s: Tried to access a deleted '%s'", + traceback ? traceback: "", + get_mtname()); ASSERT(false); // unreachable code return nullptr; }