Skip to content

Commit

Permalink
revise DDS exception logging
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed May 24, 2024
1 parent a069401 commit 8ba6d76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
21 changes: 7 additions & 14 deletions third-party/realdds/include/realdds/dds-exceptions.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2022 Intel Corporation. All Rights Reserved.

// Copyright(c) 2022-4 Intel Corporation. All Rights Reserved.
#pragma once

#include <rsutils/easylogging/easyloggingpp.h>
#include <stdexcept>
#include <rsutils/string/from.h>


// E.g.:
Expand All @@ -14,8 +12,11 @@
#define DDS_THROW( ERR_TYPE, WHAT ) \
do \
{ \
LOG_ERROR( "throwing: " << WHAT ); \
throw realdds::dds_##ERR_TYPE( rsutils::string::from() << WHAT ); \
std::ostringstream os__; \
os__ << WHAT; \
auto log_message__ = os__.str(); \
LOG_ERROR_STR( "throwing: " << log_message__ ); \
throw realdds::dds_##ERR_TYPE( std::move( log_message__ ) ); \
} \
while( 0 )

Expand All @@ -26,15 +27,7 @@ namespace realdds {
class dds_runtime_error : public std::runtime_error
{
public:
dds_runtime_error( std::string const& str )
: std::runtime_error( str )
{
}

dds_runtime_error( char const* lpsz )
: std::runtime_error( lpsz )
{
}
using std::runtime_error::runtime_error;
};


Expand Down
1 change: 1 addition & 0 deletions third-party/realdds/src/dds-device-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <realdds/dds-guid.h>
#include <realdds/dds-sample.h>

#include <rsutils/string/from.h>
#include <rsutils/string/shorten-json-string.h>
#include <rsutils/json.h>
using rsutils::json;
Expand Down
1 change: 1 addition & 0 deletions third-party/realdds/src/dds-participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <fastdds/dds/core/status/SubscriptionMatchedStatus.hpp>
#include <fastdds/rtps/transport/UDPv4TransportDescriptor.h>

#include <rsutils/string/from.h>
#include <rsutils/string/slice.h>
#include <rsutils/json.h>

Expand Down

0 comments on commit 8ba6d76

Please sign in to comment.