ClickHouse/src/Common/ZooKeeper/KeeperException.h

33 lines
863 B
C++
Raw Normal View History

2014-03-07 13:50:58 +00:00
#pragma once
#include <Common/ZooKeeper/Types.h>
2014-03-07 13:50:58 +00:00
namespace zkutil
{
using KeeperException = Coordination::Exception;
2014-03-07 13:50:58 +00:00
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:
static size_t getFailedOpIndex(Coordination::Error code, const Coordination::Responses & responses);
};
}