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 <jinmhu@microsoft.com>

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
Co-authored-by: JinmingHu <jinmhu@microsoft.com>
This commit is contained in:
Anton Kolesnyk 2021-05-28 16:24:42 +00:00 committed by GitHub
parent a742608406
commit 15c525d387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -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();
}
}
}

View File

@ -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;

View File

@ -88,7 +88,7 @@ public:
}
default:
// imposible to get here
throw;
AZURE_UNREACHABLE_CODE();
}
}