aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/ZooKeeper/KeeperException.h
blob: f957bd2288f78fdf1399b2eae82985adddafa4a3 (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
28
29
30
31
32
33
#pragma once

#include <Common/ZooKeeper/Types.h>


namespace zkutil
{


using KeeperException = Coordination::Exception;


class KeeperMultiException : public KeeperException
{
public:
    Coordination::Requests requests;
    Coordination::Responses responses;
    size_t failed_op_index = 0;

    std::string getPathForFirstFailedOp() const;

    /// If it is user error throws KeeperMultiException else throws ordinary KeeperException
    /// If it is ZOK does nothing
    static void check(Coordination::Error code, const Coordination::Requests & requests, const Coordination::Responses & responses);

    KeeperMultiException(Coordination::Error code, const Coordination::Requests & requests, const Coordination::Responses & responses);

private:
    KeeperMultiException(Coordination::Error code, size_t failed_op_index_, const Coordination::Requests & requests_, const Coordination::Responses & responses_);
};

size_t getFailedOpIndex(Coordination::Error code, const Coordination::Responses & responses);
}