summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_lua_utils.h
diff options
context:
space:
mode:
authorKefu Chai <kchai@redhat.com>2021-06-08 06:30:37 +0200
committerKefu Chai <kchai@redhat.com>2021-06-08 06:44:35 +0200
commit9b2e0b6ac2986489fea4d40a6ee7be21d21111a6 (patch)
tree1796ec4b748cdd31a2a57b858aac7c9636d1f008 /src/rgw/rgw_lua_utils.h
parentMerge pull request #41742 from lmgdlmgd/master (diff)
downloadceph-9b2e0b6ac2986489fea4d40a6ee7be21d21111a6.tar.xz
ceph-9b2e0b6ac2986489fea4d40a6ee7be21d21111a6.zip
rgw/rgw_lua_utils: return error using luaL_error()
it's found on aarch64, the exception is not caught even if we do catch exactly the same type of thrown exception, and the uncaught exception ends up with a std::terminate() call. it could be the ABI mismatch in aarch64, so the C++ runtime failed to find the catch block. in this change, luaL_error() is used to populate the error to the caller instead to workaround this issue. Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/rgw/rgw_lua_utils.h')
-rw-r--r--src/rgw/rgw_lua_utils.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/rgw/rgw_lua_utils.h b/src/rgw/rgw_lua_utils.h
index 47f7437f3ab..53b6cfc28f2 100644
--- a/src/rgw/rgw_lua_utils.h
+++ b/src/rgw/rgw_lua_utils.h
@@ -149,22 +149,19 @@ struct EmptyMetaTable {
// by default everythinmg is "readonly"
// to change, overload this function in the derived
static int NewIndexClosure(lua_State* L) {
- throw std::runtime_error("trying to write to readonly field");
- return NO_RETURNVAL;
+ return luaL_error(L, "trying to write to readonly field");
}
// by default nothing is iterable
// to change, overload this function in the derived
static int PairsClosure(lua_State* L) {
- throw std::runtime_error("trying to iterate over non-iterable field");
- return ONE_RETURNVAL;
+ return luaL_error(L, "trying to iterate over non-iterable field");
}
// by default nothing is iterable
// to change, overload this function in the derived
static int LenClosure(lua_State* L) {
- throw std::runtime_error("trying to get length of non-iterable field");
- return ONE_RETURNVAL;
+ return luaL_error(L, "trying to get length of non-iterable field");
}
static void throw_unknown_field(const std::string& index, const std::string& table) {