23#if !defined(LOOS_EXCEPTIONS_HPP)
24#define LOOS_EXCEPTIONS_HPP
30#include <loos_defs.hpp>
37 std::ostream& operator<<(std::ostream&,
const Atom&);
44 explicit LOOSError() : _msg(
"LOOS Error") { }
45 explicit LOOSError(
const std::string& arg) : _msg(arg) { }
48 ss << a << std::endl << arg;
51 explicit LOOSError(
const std::string& fname,
const Atom& a,
const std::string& arg) {
53 ss <<
"In file: " + fname << std::endl << a << std::endl << arg;
58 virtual const char* what(
void)
const throw() {
return(_msg.c_str()); }
100 ss << arg <<
", info = " << info;
117 std::string _operation;
118 std::string _filename;
124 FileError(
const std::string& op,
const std::string& fname)
125 :
LOOSError(
"Error while " + op +
" " + fname),
126 _operation(op), _filename(fname)
130 const std::string& fname,
131 const std::string& msg)
132 :
LOOSError(
"Error while " + op +
" " + fname + msg),
138 const std::string& fname,
139 const std::string& msg,
141 :
LOOSError(
"Error while " + op +
" " + fname + msg),
150 std::string
operation()
const throw() {
return(_operation); }
153 std::string
filename()
const throw() {
return(_filename); }
179 FileOpenError(
const std::string& fname,
const std::string& msg) :
FileError(
"opening", fname,
'\n' + msg) {}
180 FileOpenError(
const std::string& fname,
const std::string& msg,
const int err) :
FileError(
"opening", fname,
'\n' + msg, err) {}
189 FileReadError(
const std::string& fname,
const std::string& msg) :
FileError(
"reading from", fname,
'\n' + msg) {}
190 FileReadError(
const std::string& fname,
const std::string& msg,
const int err) :
FileError(
"reading from", fname,
'\n' + msg, err) {}
220 std::ostringstream oss;
222 oss << FileReadError::_msg <<
" at line " << _lineno << std::endl << _msg;
223 FileReadError::_msg = oss.str();
234 FileWriteError(
const std::string& fname,
const std::string& msg) :
FileError(
"writing to", fname,
'\n' + msg) {}
244 std::string _operation;
245 std::string _filename;
252 :
LOOSError(
"Error while " + op +
", " + fname),
253 _operation(op), _filename(fname)
257 const std::string& fname,
258 const std::string& msg)
259 :
LOOSError(
"Error while " + op +
", " + fname +
"\n" + msg),
265 const std::string& fname,
266 const std::string& msg,
268 :
LOOSError(
"Error while " + op +
", " + fname +
"\n" + msg),
276 std::string
operation()
const throw() {
return(_operation); }
279 std::string
filename()
const throw() {
return(_filename); }
Basic Atom class for handling atom properties.
Definition Atom.hpp:50
Errors related to File I/O.
Definition exceptions.hpp:115
void errorCode(const int i)
Sets the error code.
Definition exceptions.hpp:159
int errorCode() const
The error code that may have been generated.
Definition exceptions.hpp:156
std::string operation() const
What operation was involved (e.g. reading, writing. etc)
Definition exceptions.hpp:150
std::string filename() const
File that had the problem (or "stream" if not a file)
Definition exceptions.hpp:153
Error while opening a file.
Definition exceptions.hpp:175
Errors that occur while reading a file.
Definition exceptions.hpp:185
Errors that occur while reading a text file (where lines are tracked)
Definition exceptions.hpp:195
uint lineNumber() const
The line number that caused the problem.
Definition exceptions.hpp:214
Errors while writing to files.
Definition exceptions.hpp:230
Generic LOOS exception.
Definition exceptions.hpp:40
Exception caused by a blas/atlas error.
Definition exceptions.hpp:96
Exception in options.
Definition exceptions.hpp:63
Exception when parsing input data.
Definition exceptions.hpp:69
Errors related to trajectory reading and writing.
Definition exceptions.hpp:242
void errorCode(const int i)
Sets the error code.
Definition exceptions.hpp:285
int errorCode() const
The error code that may have been generated.
Definition exceptions.hpp:282
std::string filename() const
File that had the problem (or "stream" if not a file)
Definition exceptions.hpp:279
std::string operation() const
What operation was involved (e.g. reading, writing. etc)
Definition exceptions.hpp:276
Exception when trying to use an unset Atom property.
Definition exceptions.hpp:76
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3
Exception indicating internal XDR error.
Definition exceptions.hpp:89