2016-01-28 11:41:56 -05:00
|
|
|
#ifndef OSRM_EXCEPTION_HPP
|
|
|
|
#define OSRM_EXCEPTION_HPP
|
2015-01-27 11:44:46 -05:00
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
#include <string>
|
2015-08-18 06:56:34 -04:00
|
|
|
#include <utility>
|
2015-01-27 11:44:46 -05:00
|
|
|
|
|
|
|
namespace osrm
|
|
|
|
{
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace util
|
|
|
|
{
|
|
|
|
|
2015-01-27 11:44:46 -05:00
|
|
|
class exception final : public std::exception
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit exception(const char *message) : message(message) {}
|
2015-08-18 06:56:34 -04:00
|
|
|
explicit exception(std::string message) : message(std::move(message)) {}
|
2016-02-16 13:51:04 -05:00
|
|
|
const char *what() const noexcept override { return message.c_str(); }
|
2015-01-27 11:44:46 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
// This function exists to 'anchor' the class, and stop the compiler from
|
|
|
|
// copying vtable and RTTI info into every object file that includes
|
|
|
|
// this header. (Caught by -Wweak-vtables under Clang.)
|
|
|
|
virtual void anchor() const;
|
|
|
|
const std::string message;
|
|
|
|
};
|
|
|
|
}
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
|
2016-01-28 11:41:56 -05:00
|
|
|
#endif /* OSRM_EXCEPTION_HPP */
|