MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / setErrorResponseForZKCode

Function setErrorResponseForZKCode

src/Server/KeeperHTTPStorageHandler.cpp:90–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90bool setErrorResponseForZKCode(const Coordination::Error error, HTTPServerResponse & response)
91{
92 switch (error)
93 {
94 case Coordination::Error::ZOK:
95 return false;
96 case Coordination::Error::ZNONODE:
97 response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_NOT_FOUND, "Node not found.");
98 *response.send() << "Requested node not found.\n";
99 return true;
100 case Coordination::Error::ZNODEEXISTS:
101 response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_CONFLICT, "Node already exists.");
102 *response.send() << "Node already exists.\n";
103 return true;
104 case Coordination::Error::ZBADVERSION:
105 response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_CONFLICT, "Version conflict.");
106 *response.send() << "Version conflict. Check the current version and try again.\n";
107 return true;
108 default:
109 response.setStatus(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
110 *response.send() << "Keeper request finished with error: " << errorMessage(error) << ".\n";
111 return true;
112 }
113}
114}
115
116KeeperHTTPStorageHandler::KeeperHTTPStorageHandler(

Calls 4

setStatusAndReasonMethod · 0.80
errorMessageFunction · 0.50
sendMethod · 0.45
setStatusMethod · 0.45

Tested by

no test coverage detected