From 45a3d085b86e4d761a30718d05be40d4640ba63f Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 23 Jan 2015 12:08:15 +0100 Subject: Adapted LoggableException according to new SourceLocation class. --- src/core/common/Exceptions.hpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/core/common/Exceptions.hpp') diff --git a/src/core/common/Exceptions.hpp b/src/core/common/Exceptions.hpp index 2a88427..0be33b3 100644 --- a/src/core/common/Exceptions.hpp +++ b/src/core/common/Exceptions.hpp @@ -77,14 +77,6 @@ public: * makes it simple to handle non-recoverable errors in the code. */ class LoggableException : public OusiaException { -private: - /** - * Function used internally to build the formated message that should be - * reported to the runtime environment. - */ - static std::string formatMessage(const std::string &msg, - const SourceLocation &loc); - public: /** * Reported error message. @@ -104,7 +96,7 @@ public: */ LoggableException(std::string msg, SourceLocation loc = SourceLocation{}) - : OusiaException(formatMessage(msg, loc)), + : OusiaException(msg), msg(std::move(msg)), loc(std::move(loc)) { @@ -128,14 +120,26 @@ public: * Constructor of LoggableException for arbitrary position objects. * * @param msg is the actual log message. - * @param loc is a reference to a variable with position and context data. + * @param loc is a reference to a variable with location data. */ template - LoggableException(std::string msg, LocationType &loc) + LoggableException(std::string msg, const LocationType &loc) : LoggableException(std::move(msg), loc.getLocation()) { } + /** + * Constructor of LoggableException for arbitrary position objects. + * + * @param msg is the actual log message. + * @param loc is a pointe to a variable with location data. + */ + template + LoggableException(std::string msg, const LocationType *loc) + : LoggableException(std::move(msg), loc->getLocation()) + { + } + /** * Returns the position at which the exception occured in the text. * -- cgit v1.2.3