From 15c525d38788001b9b9393503d8cbc458e8cd49f Mon Sep 17 00:00:00 2001 From: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Date: Fri, 28 May 2021 16:24:42 +0000 Subject: [PATCH] Fix empty rethrows, update some catches to catch all (#2362) * Fix empty rethrows, update some catches to catch all * AZURE_UNREACHABLE_CODE() Co-authored-by: JinmingHu Co-authored-by: Anton Kolesnyk Co-authored-by: JinmingHu --- sdk/core/azure-core/src/http/curl/curl.cpp | 4 ++-- sdk/core/azure-core/src/io/body_stream.cpp | 4 ++-- sdk/keyvault/azure-security-keyvault-common/src/sha.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp index 08517c6d9..210f6c625 100644 --- a/sdk/core/azure-core/src/http/curl/curl.cpp +++ b/sdk/core/azure-core/src/http/curl/curl.cpp @@ -996,7 +996,7 @@ int64_t CurlSession::ResponseBufferParser::Parse( { // Should never happen that parser is not statusLIne or Headers and we still try // to parse more. - throw; + AZURE_UNREACHABLE_CODE(); } // clean internal buffer this->m_internalBuffer.clear(); @@ -1034,7 +1034,7 @@ int64_t CurlSession::ResponseBufferParser::Parse( { // Should never happen that parser is not statusLIne or Headers and we still try // to parse more. - throw; + AZURE_UNREACHABLE_CODE(); } } } diff --git a/sdk/core/azure-core/src/io/body_stream.cpp b/sdk/core/azure-core/src/io/body_stream.cpp index de2f8f292..020d40182 100644 --- a/sdk/core/azure-core/src/io/body_stream.cpp +++ b/sdk/core/azure-core/src/io/body_stream.cpp @@ -130,7 +130,7 @@ FileBodyStream::FileBodyStream(const std::string& filename) m_randomAccessFileBodyStream = std::make_unique<_internal::RandomAccessFileBodyStream>( _internal::RandomAccessFileBodyStream(m_filehandle, 0, fileSize.QuadPart)); } - catch (const std::exception&) + catch (...) { if (fileHandle != INVALID_HANDLE_VALUE) { @@ -156,7 +156,7 @@ FileBodyStream::FileBodyStream(const std::string& filename) m_randomAccessFileBodyStream = std::make_unique<_internal::RandomAccessFileBodyStream>( _internal::RandomAccessFileBodyStream(m_fileDescriptor, 0, fileSize)); } - catch (const std::exception&) + catch (...) { close(m_fileDescriptor); throw; diff --git a/sdk/keyvault/azure-security-keyvault-common/src/sha.cpp b/sdk/keyvault/azure-security-keyvault-common/src/sha.cpp index 308c62cee..f670df0ec 100644 --- a/sdk/keyvault/azure-security-keyvault-common/src/sha.cpp +++ b/sdk/keyvault/azure-security-keyvault-common/src/sha.cpp @@ -88,7 +88,7 @@ public: } default: // imposible to get here - throw; + AZURE_UNREACHABLE_CODE(); } }