| 88 | } |
| 89 | |
| 90 | bool 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 | |
| 116 | KeeperHTTPStorageHandler::KeeperHTTPStorageHandler( |
no test coverage detected