File: NeXusException.hpp

package info (click to toggle)
nexus 4.4.3-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,864 kB
  • sloc: cpp: 34,928; ansic: 17,317; f90: 2,326; xml: 2,071; java: 1,953; fortran: 1,529; python: 766; makefile: 532; sh: 460; tcl: 173; lisp: 169
file content (51 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (3)
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
#ifndef NEXUSEXCEPTION_HPP
#define NEXUSEXCEPTION_HPP 1

#include <string>
#include <stdexcept>
#include "NeXusExport.hpp"

/**
 * \file NeXusException.hpp
 * Header for a base NeXus::Exception
 * \ingroup cpp_main
 */

namespace NeXus{

  /**
   * Class that provides for a standard NeXus exception
   * \ingroup cpp_core
   */

  class NXDLL_EXPORT Exception : public std::runtime_error
  {
  public:
    /**
     * Create a new NeXus::Exception
     *
     * \param msg the string to pass a the error message
     * \param status 
     */
    Exception(const std::string& msg = "GENERIC ERROR", const int status = 0);
    /**
     * Get the message associated with the exception
     *
     * \return the message associated with the exception
     */
    virtual const char* what() const throw();
    /** 
     * Get the status associated with the exception
     *
     * \return the status value associated with the exception
     */
    int status() throw();
    /** Destructor for exception */
    virtual ~Exception() throw();
  private:
    std::string m_what; ///< Error message for the exception
    int m_status; ///< Status value for the exception
  };
};

#endif