source: trunk/bindings/cpp/NeXusException.hpp @ 1822

Revision 1732, 1.1 KB checked in by Freddie Akeroyd, 7 months ago (diff)

Merge in Mantid mods from Roman. Refs #297

  • Property svn:keywords set to HeadURL LastChangedBy LastChangedRevision LastChangedDate
Line 
1#ifndef NEXUSEXCEPTION_HPP
2#define NEXUSEXCEPTION_HPP 1
3
4#include <string>
5#include <stdexcept>
6
7/**
8 * \file NeXusException.hpp
9 * Header for a base NeXus::Exception
10 * \ingroup cpp_main
11 */
12
13namespace NeXus{
14
15  /**
16   * Class that provides for a standard NeXus exception
17   * \ingroup cpp_core
18   */
19
20  class NXDLL_EXPORT Exception : public std::runtime_error
21  {
22  public:
23    /**
24     * Create a new NeXus::Exception
25     *
26     * \param msg the string to pass a the error message
27     * \param status
28     */
29    Exception(const std::string& msg = "GENERIC ERROR", const int status = 0);
30    /**
31     * Get the message associated with the exception
32     *
33     * \return the message associated with the exception
34     */
35    virtual const char* what() const throw();
36    /**
37     * Get the status associated with the exception
38     *
39     * \return the status value associated with the exception
40     */
41    int status() throw();
42    /** Destructor for exception */
43    virtual ~Exception() throw();
44  private:
45    std::string m_what; ///< Error message for the exception
46    int m_status; ///< Status value for the exception
47  };
48};
49
50#endif
Note: See TracBrowser for help on using the repository browser.