/usr/include/tango/TangoExceptionsHelper.h is in libtango8-dev 8.1.2c+dfsg-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | //
// Copyright (C) : 2004,2005,2006,2007,2008,2009,2010,2011,2012,2013
// Synchrotron SOLEIL
// L'Orme des Merisiers
// Saint-Aubin - BP 48 - France
//
// This file is part of Tango.
//
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Tango. If not, see <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------
// WINDOWS PRAGMA
//-----------------------------------------------------------------------------
#if defined (WIN32)
# pragma warning (disable : 4286)
#endif
//-----------------------------------------------------------------------------
// DEFINE A SPECIAL VERSION OF TANGO ERROR_STREAM MACRO SO THAT FOLLOWING
// MACROS CAN BE SAFELY USED FROM C++ (PURE) CLIENT WHERE THERE IS NO
// INSTANCIATED LOGGER
//-----------------------------------------------------------------------------
#define _ERROR_STREAM \
if (get_logger() && get_logger()->is_error_enabled()) \
get_logger()->error_stream() << log4tango::LogInitiator::_begin_log
//=============================================================================
// _HANDLE_DEV_EXCEPTION MACRO
//=============================================================================
#define _HANDLE_DEV_EXCEPTION(_cmd, _origin) _HANDLE_DEV_EXCEPTION_FILE_LINE(_cmd,_origin, __FILE__, __LINE__)
#define _HANDLE_DEV_EXCEPTION_FILE_LINE(_cmd, _origin, _file, _line) \
catch (Tango::ConnectionFailed &e) { \
TangoSys_OMemStream d; \
d << "Tango::ConnectionFailed exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_CONNECTION_FAILED"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::CommunicationFailed &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::CommunicationFailed exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_COMMUNICATION_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::WrongNameSyntax &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::WrongNameSyntax exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_WRONG_NAME_SYNTAX_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::NonDbDevice &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::NonDbDevice exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_NON_DB_DEVICE_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::WrongData &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::WrongData exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_WRONG_DATA_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::NonSupportedFeature &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::NonSupportedFeature exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_NON_SUPPORTED_FEATURE_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::AsynCall &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::AsynCall exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_ASYNC_CALL_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::AsynReplyNotArrived &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::EventSystemFailed exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_ASYNC_REPLY_NOT_ARRIVED_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::EventSystemFailed &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::EventSystemFailed exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << static_cast<const Tango::DevFailed&>(e) << std::endl; \
Tango::Except::re_throw_exception(static_cast<Tango::DevFailed&>(e), \
static_cast<const char*>("TANGO_EVENT_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (Tango::DevFailed &e) \
{ \
TangoSys_OMemStream d; \
d << "Tango::DevFailed exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
_ERROR_STREAM << e << std::endl; \
Tango::Except::re_throw_exception(e, \
static_cast<const char*>("TANGO_DEVICE_ERROR"), \
static_cast<const char*>(d.str().c_str()), \
static_cast<const char*>(o.str().c_str())); \
} \
catch (const std::bad_alloc &) \
{ \
TangoSys_OMemStream d; \
d << "std::bad_alloc exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
Tango::DevErrorList errors(1); \
errors.length(1); \
errors[0].severity = Tango::ERR; \
errors[0].reason = CORBA::string_dup("OUT_OF_MEMORY"); \
errors[0].desc = CORBA::string_dup(d.str().c_str()); \
errors[0].origin = CORBA::string_dup(o.str().c_str()); \
Tango::DevFailed df(errors); \
_ERROR_STREAM << df << std::endl; \
throw df; \
} \
catch (...) \
{ \
TangoSys_OMemStream d; \
d << "unknown exception caught while trying to execute " \
<< _cmd \
<< std::ends; \
TangoSys_OMemStream o; \
o << _origin << " [" << _file << "::" << _line << "]" << std::ends; \
Tango::DevErrorList errors(1); \
errors.length(1); \
errors[0].severity = Tango::ERR; \
errors[0].reason = CORBA::string_dup("UNKNOWN_ERROR"); \
errors[0].desc = CORBA::string_dup(d.str().c_str()); \
errors[0].origin = CORBA::string_dup(o.str().c_str()); \
Tango::DevFailed df(errors); \
_ERROR_STREAM << df << std::endl; \
throw df; \
}
//=============================================================================
// _DEV_TRY MACRO
//=============================================================================
#define _DEV_TRY_FILE_LINE(_invoke, _cmd, _origin, _file, _line) \
try \
{ \
_invoke; \
} \
_HANDLE_DEV_EXCEPTION_FILE_LINE(_cmd, _origin, _file, _line)
//=============================================================================
// _DEV_TRY MACRO
//=============================================================================
#define _DEV_TRY(_invoke, _cmd, _origin) \
try \
{ \
_invoke; \
} \
_HANDLE_DEV_EXCEPTION(_cmd, _origin)
//=============================================================================
// _HANDLE_ASL_EXCEPTION_REACTION MACRO
//=============================================================================
#define _HANDLE_DEV_EXCEPTION_REACTION(_cmd, _origin, _reaction) \
catch (...) \
{ \
_reaction; \
_DEV_TRY(throw, _cmd, _origin) \
}
//=============================================================================
// _DEV_TRY_ACTION MACRO
//=============================================================================
#define _DEV_TRY_ACTION(_invoke, _cmd, _origin, _action ) \
try { \
_DEV_TRY(_invoke, _cmd, _origin) \
_action; \
} \
catch (...) { \
_action; \
throw; \
}
//=============================================================================
// _DEV_TRY_REACTION MACRO
//=============================================================================
#define _DEV_TRY_REACTION(_invoke, _cmd, _origin, _reaction) \
try { \
_DEV_TRY(_invoke, _cmd, _origin) \
} \
catch (...) { \
_reaction; \
throw; \
}
|