Better RTCError handling + tests

This commit is contained in:
Théo Monnom
2022-09-13 14:19:44 +02:00
parent d9fd69b5c0
commit 12a6d232b5
16 changed files with 325 additions and 82 deletions
@@ -6,20 +6,20 @@
#define CLIENT_SDK_NATIVE_RTC_ERROR_H
#include "api/rtc_error.h"
#include "libwebrtc-sys/src/rtc_error.rs.h"
#include "rust_types.h"
#include "rust/cxx.h"
namespace livekit {
class RTCError {
public:
explicit RTCError(webrtc::RTCError error);
RTCError to_error(const webrtc::RTCError &error);
std::string serialize_error(const RTCError &error); // to be used inside cxx::Exception msg
private:
webrtc::RTCError rtc_error_;
};
#ifdef LIVEKIT_TEST
rust::String serialize_deserialize();
void throw_error();
#endif
static std::unique_ptr<RTCError> _unique_rtc_error(){
return nullptr; // Ignore
}
} // livekit
#endif //CLIENT_SDK_NATIVE_RTC_ERROR_H
@@ -17,6 +17,7 @@ namespace livekit {
// Shared types
struct RTCOfferAnswerOptions;
struct RTCError;
}
#endif //RUST_TYPES_H