This commit is contained in:
wangjiyu 2025-04-11 09:15:57 +08:00
parent d9c0012c75
commit 7bb8108410
1 changed files with 11 additions and 0 deletions

View File

@ -356,6 +356,17 @@ void RTCContext::onAudioProcess(const char* roomId, const char* peerId,
}
std::cout << " 回调执行成功" << std::endl;
} catch (const py::error_already_set& e) {
std::cerr << "[PYTHON ERROR] ";
PyErr_Print(); // 自动打印到stderr
// 可选:获取更详细的错误信息
if (PyErr_Occurred()) {
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
std::cerr << "Details: "
<< PyUnicode_AsUTF8(PyObject_Str(value)) << std::endl;
PyErr_Restore(type, value, traceback);
}
} catch (...) {
std::cout << "[ERROR] 回调执行失败" << std::endl;
munmap(ptr, data_size);