ClickHouse/src/Common/NetException.h
Amos Bird a25bb50096
Refactor many exception messages
1. Always use fmt variant
2. Remove redundant period at the end of message
3. Remove useless parenthesis
2022-04-24 19:44:00 +08:00

30 lines
758 B
C++

#pragma once
#include <Common/Exception.h>
namespace DB
{
class NetException : public Exception
{
public:
NetException(const std::string & msg, int code) : Exception(msg, code) {}
// Format message with fmt::format, like the logging functions.
template <typename... Args>
NetException(int code, fmt::format_string<Args...> fmt, Args &&... args)
: Exception(fmt::format(fmt, std::forward<Args>(args)...), code)
{
}
NetException * clone() const override { return new NetException(*this); }
void rethrow() const override { throw *this; }
private:
const char * name() const throw() override { return "DB::NetException"; }
const char * className() const throw() override { return "DB::NetException"; }
};
}