diff --git a/src/viam/sdk/common/exception.cpp b/src/viam/sdk/common/exception.cpp index 3a76efde4..eaf288041 100644 --- a/src/viam/sdk/common/exception.cpp +++ b/src/viam/sdk/common/exception.cpp @@ -10,8 +10,6 @@ Exception::Exception(ErrorCondition condition, const std::string& what) Exception::Exception(const std::string& what) : Exception(ErrorCondition::k_general, what) {}; -Exception::~Exception() = default; - const std::error_condition& Exception::condition() const noexcept { return condition_; }; @@ -49,9 +47,7 @@ std::error_condition make_error_condition(ErrorCondition e) { GRPCException::GRPCException(const grpc::Status* status) : Exception(ErrorCondition::k_grpc, status->error_message()), - status_(std::make_unique(*status)) {} - -GRPCException::~GRPCException() = default; + status_(std::make_shared(*status)) {} const grpc::Status* GRPCException::status() const noexcept { return status_.get(); diff --git a/src/viam/sdk/common/exception.hpp b/src/viam/sdk/common/exception.hpp index adfdc6ecd..c43c8fda7 100644 --- a/src/viam/sdk/common/exception.hpp +++ b/src/viam/sdk/common/exception.hpp @@ -42,7 +42,8 @@ class Exception : public std::runtime_error { public: explicit Exception(ErrorCondition condition, const std::string& what); explicit Exception(const std::string& what); - virtual ~Exception(); + + ~Exception() override = default; const std::error_condition& condition() const noexcept; @@ -56,12 +57,12 @@ class Exception : public std::runtime_error { class GRPCException : public Exception { public: explicit GRPCException(const grpc::Status* status); - ~GRPCException(); + ~GRPCException() override = default; const grpc::Status* status() const noexcept; private: - std::unique_ptr status_; + std::shared_ptr status_; }; } // namespace sdk