Suppress exceptions in destructors

This commit is contained in:
nsubiron 2018-10-22 16:41:22 +02:00
parent 980f0e6a9b
commit 0bf58e3bf8
2 changed files with 13 additions and 2 deletions

View File

@ -6,9 +6,12 @@
#include "carla/client/detail/Episode.h"
#include "carla/Logging.h"
#include "carla/client/detail/Client.h"
#include "carla/sensor/Deserializer.h"
#include <exception>
namespace carla {
namespace client {
namespace detail {
@ -25,7 +28,11 @@ namespace detail {
_state(std::make_shared<EpisodeState>()) {}
Episode::~Episode() {
_client.UnSubscribeFromStream(_description.token);
try {
_client.UnSubscribeFromStream(_description.token);
} catch (const std::exception &e) {
log_error("exception trying to disconnect from episode:", e.what());
}
}
void Episode::Listen() {

View File

@ -31,7 +31,11 @@ namespace detail {
// session remaining since at this point the io_service should be already
// stopped.
for (auto &pair : _stream_map) {
pair.second->ClearSessions();
try {
pair.second->ClearSessions();
} catch (const std::exception &e) {
log_error("failed to clear sessions:", e.what());
}
}
}