aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/ShellCommandSettings.cpp
blob: 951a20e949cf57882374aecfa41bd11db4cbc89d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <Common/ShellCommandSettings.h>

#include <magic_enum.hpp>
#include <Poco/String.h>
#include <Common/Exception.h>

namespace DB
{

namespace ErrorCodes
{
    extern const int BAD_ARGUMENTS;
}

ExternalCommandStderrReaction parseExternalCommandStderrReaction(const std::string & config)
{
    auto reaction = magic_enum::enum_cast<ExternalCommandStderrReaction>(Poco::toUpper(config));
    if (!reaction)
        throw Exception(
            ErrorCodes::BAD_ARGUMENTS,
            "Unknown stderr_reaction: {}. Possible values are 'none', 'log', 'log_first', 'log_last' and 'throw'",
            config);

    return *reaction;
}

}