diff options
| author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-05 14:16:27 +0100 |
|---|---|---|
| committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2014-12-05 14:16:27 +0100 |
| commit | 30765a8bbf30aafad89a632afc39966c5b4029b8 (patch) | |
| tree | b9540230f7ac8ac68d66caf7d727e7413a56f631 /src/core/Exceptions.hpp | |
| parent | fddd8a6fc3c9a7971111a345a83283a0a1662f9f (diff) | |
| parent | bf59bc2edbb1f3f4d12bfbd8ed2663fbbb1900c0 (diff) | |
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'src/core/Exceptions.hpp')
| -rw-r--r-- | src/core/Exceptions.hpp | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/src/core/Exceptions.hpp b/src/core/Exceptions.hpp index f1bb95a..00d6106 100644 --- a/src/core/Exceptions.hpp +++ b/src/core/Exceptions.hpp @@ -82,7 +82,7 @@ private: */ static std::string formatMessage(const std::string &msg, const std::string &file, int line, - int column, bool fatal); + int column); public: /** @@ -106,28 +106,20 @@ public: const int column; /** - * If set to true, the exception should not be handled as recoverable error - * but as "fatal" error. - */ - const bool fatal; - - /** * Constructor of the LoggableException class. * * @param msg contains the error message. * @param file provides the context the message refers to. May be empty. * @param line is the line in the above file the message refers to. * @param column is the column in the above file the message refers to. - * @param fatal shoudl be set to true if the error is non-recoverable. */ LoggableException(std::string msg, std::string file, int line = -1, - int column = -1, bool fatal = true) - : OusiaException(formatMessage(msg, file, line, column, fatal)), + int column = -1) + : OusiaException(formatMessage(msg, file, line, column)), msg(std::move(msg)), file(std::move(file)), line(line), - column(column), - fatal(fatal) + column(column) { } @@ -137,30 +129,30 @@ public: * @param msg contains the error message. * @param line is the line in the above file the message refers to. * @param column is the column in the above file the message refers to. - * @param fatal shoudl be set to true if the error is non-recoverable. */ - LoggableException(std::string msg, int line = -1, int column = -1, - bool fatal = true) - : OusiaException(formatMessage(msg, "", line, column, fatal)), + LoggableException(std::string msg, int line = -1, int column = -1) + : OusiaException(formatMessage(msg, "", line, column)), msg(std::move(msg)), line(line), - column(column), - fatal(fatal) + column(column) { } /** - * Constructor of the LoggableException class with empty file. + * Constructor of the LoggableException class with empty file and an + * position object. * - * @param msg contains the error message. - * @param fatal should be set to true if the error is non-recoverable. + * @param msg is the actual log message. + * @param pos is a const reference to a variable which provides position + * information. */ - LoggableException(std::string msg, bool fatal) - : OusiaException(formatMessage(msg, "", -1, -1, fatal)), + template <class PosType> + LoggableException(std::string msg, const PosType &pos) + : OusiaException( + formatMessage(msg, "", pos.getLine(), pos.getColumn())), msg(std::move(msg)), - line(-1), - column(-1), - fatal(fatal) + line(pos.getLine()), + column(pos.getColumn()) { } }; |
