memgraph/include/utils/exceptions/basic_exception.hpp
Florijan Stamenkovic b329225322 storage/model - added typed_value system and tests. Modified utils slightly (backward compatible).
Summary: Added TypedValue system.

Test Plan: ???

Reviewers: sale, buda

Subscribers: florijan, buda, sale

Differential Revision: https://phabricator.memgraph.io/D46
2017-02-01 14:05:08 +01:00

36 lines
879 B
C++

#pragma once
#include <fmt/format.h>
#include <fmt/ostream.h>
#include <stdexcept>
#include "utils/auto_scope.hpp"
#include "utils/stacktrace/stacktrace.hpp"
class BasicException : public std::exception
{
public:
BasicException(const std::string &message) noexcept : message_(message)
{
Stacktrace stacktrace;
message_.append(stacktrace.dump());
}
template <class... Args>
BasicException(const std::string &format, Args &&... args) noexcept
: BasicException(fmt::format(format, std::forward<Args>(args)...))
{
}
template <class... Args>
BasicException(const char* format, Args &&... args) noexcept
: BasicException(fmt::format(std::string(format), std::forward<Args>(args)...))
{
}
const char *what() const noexcept override { return message_.c_str(); }
private:
std::string message_;
};