Skip to content

Commit 71d3beb

Browse files
committed
fix: fix some stupid exception process
1 parent 6a82b1e commit 71d3beb

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/legacy/api/DeviceAPI.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ Local<Object> DeviceClass::newDevice(Player* p) {
4040

4141
// 成员函数
4242
void DeviceClass::setPlayer(Player* player) {
43-
__try {
43+
try {
4444
id = player->getOrCreateUniqueID();
45-
} __except (EXCEPTION_EXECUTE_HANDLER) {
45+
} catch (...) {
46+
lse::getSelfPluginInstance().getLogger().error("Fail in DeviceClass::setPlayer");
47+
ll::error_utils::printCurrentException(lse::getSelfPluginInstance().getLogger());
48+
LOG_ERROR_WITH_SCRIPT_INFO();
4649
isValid = false;
4750
}
4851
}

src/legacy/api/EntityAPI.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,12 @@ std::optional<Actor*> EntityClass::tryExtractActor(Local<Value> v) {
208208

209209
// 成员函数
210210
void EntityClass::set(Actor* actor) {
211-
__try {
211+
try {
212212
id = actor->getOrCreateUniqueID();
213-
} __except (EXCEPTION_EXECUTE_HANDLER) {
213+
} catch (...) {
214+
lse::getSelfPluginInstance().getLogger().error("Fail in EntityClass::set");
215+
ll::error_utils::printCurrentException(lse::getSelfPluginInstance().getLogger());
216+
LOG_ERROR_WITH_SCRIPT_INFO();
214217
isValid = false;
215218
}
216219
}

src/legacy/api/PlayerAPI.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,12 @@ Local<Value> McClass::broadcast(const Arguments& args) {
648648

649649
// 成员函数
650650
void PlayerClass::set(Player* player) {
651-
__try {
651+
try {
652652
id = player->getOrCreateUniqueID();
653-
} __except (EXCEPTION_EXECUTE_HANDLER) {
653+
} catch (...) {
654+
lse::getSelfPluginInstance().getLogger().error("Fail in PlayerClass::set");
655+
ll::error_utils::printCurrentException(lse::getSelfPluginInstance().getLogger());
656+
LOG_ERROR_WITH_SCRIPT_INFO();
654657
isValid = false;
655658
}
656659
}

0 commit comments

Comments
 (0)