diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2025-02-28 23:59:20 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2025-03-01 00:13:10 +0300 |
commit | b04e2faf41bf366d5f501c976bda00eb32d55660 (patch) | |
tree | f922ace378c0c471d912c33f2c0231144f898d78 /library/cpp/neh/http_common.cpp | |
parent | 9ba742f4d36b4a3d879b4cf8d9234165413f4a0d (diff) | |
download | ydb-b04e2faf41bf366d5f501c976bda00eb32d55660.tar.gz |
Intermediate changes
commit_hash:e2da3ad430fabaa84a74178b1f2103b09ac69ae7
Diffstat (limited to 'library/cpp/neh/http_common.cpp')
-rw-r--r-- | library/cpp/neh/http_common.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/library/cpp/neh/http_common.cpp b/library/cpp/neh/http_common.cpp index 7ae466c31a..23ed6a2889 100644 --- a/library/cpp/neh/http_common.cpp +++ b/library/cpp/neh/http_common.cpp @@ -231,5 +231,32 @@ namespace NNeh { return NeedGetRequestFor(scheme) || NeedPostRequestFor(scheme); } } + + HttpCodes GetHttpCode(const IRequest::TResponseError& error) { + switch (error) { + case IRequest::TResponseError::BadRequest: + return HttpCodes::HTTP_BAD_REQUEST; + case IRequest::TResponseError::Forbidden: + return HttpCodes::HTTP_FORBIDDEN; + case IRequest::TResponseError::NotExistService: + return HttpCodes::HTTP_NOT_FOUND; + case IRequest::TResponseError::TooManyRequests: + return HttpCodes::HTTP_TOO_MANY_REQUESTS; + case IRequest::TResponseError::InternalError: + return HttpCodes::HTTP_INTERNAL_SERVER_ERROR; + case IRequest::TResponseError::NotImplemented: + return HttpCodes::HTTP_NOT_IMPLEMENTED; + case IRequest::TResponseError::BadGateway: + return HttpCodes::HTTP_BAD_GATEWAY; + case IRequest::TResponseError::ServiceUnavailable: + return HttpCodes::HTTP_SERVICE_UNAVAILABLE; + case IRequest::TResponseError::BandwidthLimitExceeded: + return HttpCodes::HTTP_BANDWIDTH_LIMIT_EXCEEDED; + case IRequest::TResponseError::MaxResponseError: + ythrow yexception() << TStringBuf("unknow type of error"); + + Y_UNREACHABLE(); + } + } } |