File kernel/src/utils/SiconosException.hpp#

Go to the source code of this file

!

Tools to deal with exceptions in Siconos.

Defines

THROW_EXCEPTION(X)#

Wrap exception throwing inside Siconos.

namespace Siconos
class exception : public virtual std::exception, public virtual boost::exception#
#include <SiconosException.hpp>

Siconos generic exception.

Usage :

1/ to throw an exception, use : THROW_EXCEPTION(“some message”) or THROW_EXCEPTION()

2/ to catch it :

try{ … // call to functions that may throw exceptions } catch(Siconos::exception::Exception& e) { Siconos::exception::process(e); } catch(…) { Siconos::exception::process(); }

The outputs are : the file, position in the file (line number) and function name that thrown the exception, the errno code (0 if unknown), the corresponding description of errno code (if any), the message added when the exception has been thrown.

Public Types

typedef boost::error_info<struct tag_errno_code, int> errno_code#
typedef boost::error_info<struct tag_errno_description, const char*> errno_description#
typedef boost::error_info<struct message, std::string> extra_message#

Public Static Functions

static inline void process()#

Outputs diagnostic information about unhandled exceptions.

Must be called inside a catch section.

static inline void process(Siconos::exception &e)#

Outputs diagnostic information about exceptions.

Must be called inside a catch section.