Audacity 3.2.0
Functions
audacity::cloud::audiocom::anonymous_namespace{NetworkUtils.cpp} Namespace Reference

Functions

SyncResultCode GetResultCodeFromHttpCode (int code) noexcept
 
SyncResultCode GuessResultCode (IResponse &response) noexcept
 

Function Documentation

◆ GetResultCodeFromHttpCode()

SyncResultCode audacity::cloud::audiocom::anonymous_namespace{NetworkUtils.cpp}::GetResultCodeFromHttpCode ( int  code)
noexcept

Definition at line 30 of file NetworkUtils.cpp.

31{
34
35 if (code == HttpCode::PaymentRequired)
37
38 if (code == HttpCode::Unauthorized)
40
41 if (code == HttpCode::Forbidden)
43
44 if (code == HttpCode::NotFound)
46
47 if (code == HttpCode::PayloadTooLarge)
48 return SyncResultCode::TooLarge;
49
50 if (code == HttpCode::Gone)
51 return SyncResultCode::Expired;
52
53 if (code > 500)
55
56 return SyncResultCode::UnknownError;
57}

References audacity::cloud::audiocom::Conflict, audacity::network_manager::HttpCode::Conflict, audacity::cloud::audiocom::Expired, audacity::cloud::audiocom::Forbidden, audacity::network_manager::HttpCode::Forbidden, audacity::network_manager::HttpCode::Gone, audacity::cloud::audiocom::InternalServerError, audacity::cloud::audiocom::NotFound, audacity::network_manager::HttpCode::NotFound, audacity::network_manager::HttpCode::PayloadTooLarge, audacity::cloud::audiocom::PaymentRequired, audacity::network_manager::HttpCode::PaymentRequired, audacity::cloud::audiocom::TooLarge, audacity::cloud::audiocom::Unauthorized, audacity::network_manager::HttpCode::Unauthorized, audacity::cloud::audiocom::UnknownError, and audacity::network_manager::HttpCode::UnprocessableEntity.

Referenced by GuessResultCode().

Here is the caller graph for this function:

◆ GuessResultCode()

SyncResultCode audacity::cloud::audiocom::anonymous_namespace{NetworkUtils.cpp}::GuessResultCode ( IResponse response)
noexcept

Definition at line 59 of file NetworkUtils.cpp.

60{
61 const auto code = response.getError();
62
63 if (code == NetworkError::NoError)
64 return SyncResultCode::Success;
65
66 if (code == NetworkError::OperationCancelled)
68
69 if (
70 code == NetworkError::ConnectionFailed ||
71 code == NetworkError::ConnectionRefused ||
72 code == NetworkError::HostNotFound ||
73 code == NetworkError::ProxyConnectionFailed ||
74 code == NetworkError::ProxyNotFound ||
75 code == NetworkError::RemoteHostClosed ||
76 code == NetworkError::Timeout)
77 return SyncResultCode::ConnectionFailed;
78
79 if (code == NetworkError::HTTPError)
80 return GetResultCodeFromHttpCode(response.getHTTPCode());
81
82 return SyncResultCode::UnknownError;
83}
virtual unsigned getHTTPCode() const noexcept=0
virtual NetworkError getError() const noexcept=0

References audacity::cloud::audiocom::Cancelled, audacity::cloud::audiocom::ConnectionFailed, GetResultCodeFromHttpCode(), audacity::cloud::audiocom::Success, audacity::network_manager::Timeout, and audacity::cloud::audiocom::UnknownError.

Referenced by audacity::cloud::audiocom::GetResponseResult().

Here is the call graph for this function:
Here is the caller graph for this function: