//#include "Exception.mpp"
///////////////////////////////hh.p////////////////////////////////////////
+/** \defgroup exception System exceptions
+
+ The senf::SystemException class and it's derived class template senf::ErrnoException are used to
+ signal generic system failures based on \c errno codes.
+
+ senf::SystemException is a generic \c errno based exception which carries an error number and
+ origin information. senf::ErrnoException is a derived class specialized for a specific error
+ code. This simplifies managing error conditions:
+
+ \code
+ try {
+ something.open(path);
+ // ...
+ }
+ catch (senf::ErrnoException<ENOFILE> & e) {
+ // Create new file
+ }
+ catch (senf::SystemException & e) {
+ // Catch all other system exceptions
+ std::cerr << "Error accessing '" << path << "': " << e.what() << std::endl;
+ }
+ \endcode
+
+ This exception is normally thrown using the senf::throwErrno() helper:
+
+ \code
+ if ((fd = ::open(path.c_str(), O_RDWR)) < 0)
+ senf::throwErrno("::open()");
+ \endcode
+
+ The senf::throwErrno() helper will throw the correct exception class based on some \c errno
+ value.
+ */
+
namespace senf {
/** \brief Exception handling standard UNIX errors (errno)
be thrown via one of the senf::throwErrno() helpers.
\see ErrnoException
+ \ingroup exception
*/
class SystemException : public std::exception
{
if ((fd = ::open(filename, O_RDWR)) < 0)
senf::throwErrno("open()");
\endcode
+ \ingroup exception
*/
template <int Code>
class ErrnoException : public SystemException
/** \brief Throw ErrnoException based on current \c errno value
- \related ErrnoException
+ \ingroup exception
*/
void throwErrno();
/** \brief Throw ErrnoException based on current \c errno value (with location info)
- \related ErrnoException
+ \ingroup exception
*/
void throwErrno(char const * where);
/** \brief Throw ErrnoException based on given \c errno value
- \related ErrnoException
+ \ingroup exception
*/
void throwErrno(int code);
/** \brief Throw ErrnoException based on given \c errno value (with location info)
- \related ErrnoException
+ \ingroup exception
*/
void throwErrno(char const * where, int code);
\section miscstuff Miscellaneous
<table class="listing">
- <tr><td>\ref SystemException</td><td>standard exception for system errors (errno)</td></tr>
-
- <tr><td>\ref process</td><td>Some simple process management and daemon helpers</td></tr>
+ <tr><td>\ref exception</td><td>standard exception for system errors (errno)</td></tr>
<tr><td>\ref hexdump</td><td>a simple but usefull function to write binary data in in
hexadecimal format.</td></tr>
unit tests. If the available Boost version is 1.34, this file will automatically take care of
any necessary workarounds.
- So, instead of <tt>#include <boost/test/auto_unit_test.hpp></tt>, you should always write
- <tt>#include "../Utils/auto_unit_test.hh"<tt> (with possibliy adjusted path).
+ So, instead of <tt>\#include <boost/test/auto_unit_test.hpp></tt>, you should always write
+ <tt>\#include "../Utils/auto_unit_test.hh"<tt> (with possibliy adjusted path).
*/
#ifndef HH_auto_unit_test_
never called.
This number is than forwarded as template argument to \c select which is specialized for
- each case. Therefore, <tt>choice<A></tt> has a \c frobble() member whereas
- <tt>choice<B></tt> has a \c dazzle() member.
+ each case. Therefore, <tt>choice\<A\></tt> has a \c frobble() member whereas
+ <tt>choice\<B\></tt> has a \c dazzle() member.
\see \ref SENF_MPL_RV
\ingroup senfmpl