mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
16 lines
671 B
C++
16 lines
671 B
C++
#pragma once
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
/// Throw DB::Exception-like exception before its definition.
|
|
/// DB::Exception derived from Poco::Exception derived from std::exception.
|
|
/// DB::Exception generally caught as Poco::Exception. std::exception generally has other catch blocks and could lead to other outcomes.
|
|
/// DB::Exception is not defined yet. It'd better to throw Poco::Exception but we do not want to include any big header here, even <string>.
|
|
/// So we throw some std::exception instead in the hope its catch block is the same as DB::Exception one.
|
|
template <typename T>
|
|
[[noreturn]] inline void throwError(const T & err)
|
|
{
|
|
throw std::runtime_error(err);
|
|
}
|