1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
%rr_intrusive_ptr(RobotRaconteur::MessageElement)
namespace RobotRaconteur
{
class HandlerErrorInfo;
}
//Exception handling
%exception %{
try {
$action
} catch (RobotRaconteurException& e)
{
RR_SHARED_PTR<RobotRaconteurNode> default_node = RobotRaconteurNode::weak_sp().lock();
if (default_node)
{
ROBOTRACONTEUR_LOG_DEBUG_COMPONENT(default_node, Default, -1, "Exception raised in C++, passing to wrapped language: " << e.what());
}
if (robotRaconteurExceptionHelper!=NULL)
{
RobotRaconteur::HandlerErrorInfo err3(e);
robotRaconteurExceptionHelper->SetRobotRaconteurException(err3);
return $null;
}
else
{
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, e.what());
return $null;
}
} catch (std::exception& e) {
RR_SHARED_PTR<RobotRaconteurNode> default_node = RobotRaconteurNode::weak_sp().lock();
if (default_node)
{
ROBOTRACONTEUR_LOG_DEBUG_COMPONENT(default_node, Default, -1, "Exception raised in C++, passing to wrapped language: " << e.what());
}
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, e.what());
return $null;
}
%}
%feature("director") RobotRaconteurExceptionHelper;
%inline
{
class RobotRaconteurExceptionHelper
{
public:
virtual void SetRobotRaconteurException(const RobotRaconteur::HandlerErrorInfo& error) {};
virtual ~RobotRaconteurExceptionHelper() {}
};
RobotRaconteurExceptionHelper* robotRaconteurExceptionHelper=NULL;
}
//Forward declarations of MessageElement
%rr_intrusive_ptr(RobotRaconteur::MessageEntry)
//RRDirectorExceptionHelper
namespace RobotRaconteur {
class MessageEntry;
class RRDirectorExceptionHelper
{
public:
static void Reset();
static void SetError(const boost::intrusive_ptr<RobotRaconteur::MessageEntry>& err, const std::string& exception_str);
static bool IsErrorPending();
static boost::intrusive_ptr<MessageEntry> GetError();
};
}
|