Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions Framework/Nexus/inc/MantidNexus/NeXusException.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,12 @@ namespace NeXus {

class MANTID_NEXUS_DLL 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 NXstatus status = static_cast<NXstatus>(0));
/**
* Get the message associated with the exception
*
* \return the message associated with the exception
*/
virtual const char *what() const throw() override;
/**
* Get the status associated with the exception
*
* \return the status value associated with the exception
*/
NXstatus status() const throw();
/** Destructor for exception */
virtual ~Exception() throw();
/// Create a new NeXus::Exception
Exception(const std::string &msg = "GENERIC ERROR", const std::string &filename = "");
/// \return the message with filename
const std::string filename() const throw();

private:
std::string m_what; ///< Error message for the exception
NXstatus m_status; ///< Status value for the exception
std::string m_filename; ///< File this exceptoin is associated with
};
}; // namespace NeXus
10 changes: 3 additions & 7 deletions Framework/Nexus/src/NeXusException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@

namespace NeXus {

Exception::Exception(const std::string &msg, const NXstatus status)
: std::runtime_error(msg), m_what(msg), m_status(status) {}
Exception::Exception(const std::string &msg, const std::string &filename)
: std::runtime_error(msg), m_filename(filename) {}

const char *Exception::what() const throw() { return this->m_what.c_str(); }

NXstatus Exception::status() const throw() { return this->m_status; }

Exception::~Exception() throw() {}
const std::string Exception::filename() const throw() { return this->m_filename; }

} // namespace NeXus
Loading