Mantid
Loading...
Searching...
No Matches
NexusException.cpp
Go to the documentation of this file.
2#include <ostream>
3
8namespace Mantid::Nexus {
9
10Exception::Exception(const std::string &msg, const std::string &functionname, const std::string &filename)
11 : std::runtime_error(msg), m_functionname(functionname), m_filename(filename) {}
12
13const std::string Exception::functionname() const throw() { return this->m_functionname; }
14
15const std::string Exception::filename() const throw() { return this->m_filename; }
16
17std::ostream &operator<<(std::ostream &os, const Exception &err) {
18 if (!err.functionname().empty()) {
19 os << "in function " << err.functionname() << " ";
20 }
21 os << err.what();
22 if (!err.filename().empty()) {
23 os << " in file " << err.filename();
24 }
25 return os;
26}
27
28} // namespace Mantid::Nexus
Class that provides for a standard Nexus exception.
const std::string functionname() const
std::string m_functionname
Function this exception is associted with.
std::string m_filename
File this exception is associated with.
Exception(const std::string &msg="GENERIC ERROR", const std::string &functionname="", const std::string &filename="")
Create a new Nexus::Exception.
const std::string filename() const
MANTID_API_DLL std::ostream & operator<<(std::ostream &, const AlgorithmHistory &)
Prints a text representation.
Header for a base Nexus::Exception.
STL namespace.