Suppress exceptions in Sensor's destructor
This commit is contained in:
parent
e52f780bd5
commit
bd15ef11ea
|
@ -9,6 +9,8 @@
|
|||
#include "carla/Logging.h"
|
||||
#include "carla/client/detail/Client.h"
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
||||
|
@ -20,7 +22,11 @@ namespace client {
|
|||
GetDisplayId());
|
||||
}
|
||||
if (_is_listening) {
|
||||
Stop();
|
||||
try {
|
||||
Stop();
|
||||
} catch (const std::exception &e) {
|
||||
log_error("excetion trying to stop sensor:", GetDisplayId(), ':', e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,16 @@ namespace carla {
|
|||
namespace client {
|
||||
namespace detail {
|
||||
|
||||
std::string ActorState::GetDisplayId() const {
|
||||
using namespace std::string_literals;
|
||||
return "Actor "s + std::to_string(GetId()) + " (" + GetTypeId() + ')';
|
||||
}
|
||||
ActorState::ActorState(rpc::Actor description, Episode episode)
|
||||
: _description(std::move(description)),
|
||||
_episode(std::move(episode)),
|
||||
_display_id([](const auto &desc) {
|
||||
using namespace std::string_literals;
|
||||
return
|
||||
"Actor "s +
|
||||
std::to_string(desc.id) +
|
||||
" (" + desc.description.id + ')';
|
||||
}(_description)) {}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace client
|
||||
|
|
|
@ -27,7 +27,9 @@ namespace detail {
|
|||
return _description.description.id;
|
||||
}
|
||||
|
||||
std::string GetDisplayId() const;
|
||||
const std::string &GetDisplayId() const {
|
||||
return _display_id;
|
||||
}
|
||||
|
||||
World GetWorld() const {
|
||||
return _episode;
|
||||
|
@ -51,13 +53,13 @@ namespace detail {
|
|||
|
||||
friend class detail::Client;
|
||||
|
||||
ActorState(rpc::Actor description, Episode episode)
|
||||
: _description(std::move(description)),
|
||||
_episode(std::move(episode)) {}
|
||||
ActorState(rpc::Actor description, Episode episode);
|
||||
|
||||
rpc::Actor _description;
|
||||
|
||||
Episode _episode;
|
||||
|
||||
std::string _display_id;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
|
Loading…
Reference in New Issue