diff --git a/sdk/core/azure-core/inc/http/http.hpp b/sdk/core/azure-core/inc/http/http.hpp index ed92e8269..a18b11bb5 100644 --- a/sdk/core/azure-core/inc/http/http.hpp +++ b/sdk/core/azure-core/inc/http/http.hpp @@ -265,12 +265,12 @@ namespace Azure { namespace Core { namespace Http { */ struct CouldNotResolveHostException : public std::exception { - const char* what() const throw() { return "couldnt resolve host"; } + const char* what() const throw() { return "could not resolve host"; } }; struct ErrorWhileWrittingResponse : public std::exception { - const char* what() const throw() { return "couldnt write response"; } + const char* what() const throw() { return "could not write response"; } }; // Any other excpetion from transport layer without an specific exception defined above diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index 2db962bf1..1f12c5653 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -19,13 +19,16 @@ std::unique_ptr CurlTransport::Send(Context& context, Request& request { switch (performing) { - case CURLE_COULDNT_RESOLVE_HOST: { + case CURLE_COULDNT_RESOLVE_HOST: + { throw Azure::Core::Http::CouldNotResolveHostException(); } - case CURLE_WRITE_ERROR: { + case CURLE_WRITE_ERROR: + { throw Azure::Core::Http::ErrorWhileWrittingResponse(); } - default: { + default: + { throw Azure::Core::Http::TransportException(); } } @@ -155,8 +158,8 @@ static std::unique_ptr CreateHTTPResponse( static std::unique_ptr CreateHTTPResponse(std::string const& header) { return CreateHTTPResponse( - reinterpret_cast(header.data()), - reinterpret_cast(header.data() + header.size())); + reinterpret_cast(header.data()), + reinterpret_cast(header.data() + header.size())); } // To wait for a socket to be ready to be read/write @@ -479,7 +482,7 @@ int64_t CurlSession::ReadSocketToBuffer(uint8_t* buffer, int64_t bufferSize) break; default: // Error code while reading from socket - return -1; + throw Azure::Core::Http::TransportException(); } } return readBytes; diff --git a/sdk/core/azure-core/src/http/response.cpp b/sdk/core/azure-core/src/http/response.cpp index 0b5ebb9ff..abfe0dbb9 100644 --- a/sdk/core/azure-core/src/http/response.cpp +++ b/sdk/core/azure-core/src/http/response.cpp @@ -47,8 +47,8 @@ void Response::AddHeader(uint8_t const* const begin, uint8_t const* const last) void Response::AddHeader(std::string const& header) { return AddHeader( - reinterpret_cast(header.data()), - reinterpret_cast(header.data() + header.size())); + reinterpret_cast(header.data()), + reinterpret_cast(header.data() + header.size())); } void Response::AddHeader(std::string const& name, std::string const& value)