Skip to content

Commit

Permalink
Add error handling to AzureBlobInputStream::Read method
Browse files Browse the repository at this point in the history
Introduce error handling for AzureBlobInputStream::Read. If ptrBytesRead is nullptr, construct an error message using ostringstream and throw a runtime_error indicating 'DownloadTo' operation failure with status code.
  • Loading branch information
ptahmose committed Oct 8, 2024
1 parent 6bd3f0a commit 4cc3d42
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Src/libCZI/StreamsLib/azureblobinputstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ void AzureBlobInputStream::Read(std::uint64_t offset, void* pv, std::uint64_t si
*ptrBytesRead = download_response.Value.ContentRange.Length.Value();
}
}
else
{
ostringstream string_stream;
string_stream << "'DownloadTo' failed with status code " << static_cast<int>(code) << ".";
throw runtime_error(string_stream.str());
}
}

/*static*/std::string AzureBlobInputStream::GetBuildInformation()
Expand Down

0 comments on commit 4cc3d42

Please sign in to comment.