Azure / azure-storage-cpplite

Lite version of C++ Client Library for Microsoft Azure Storage
MIT License
25 stars 43 forks source link

Empty error response for ill-formatted blob endpoint #62

Closed joe-maley closed 4 years ago

joe-maley commented 4 years ago

When executing blob_client::create_container on an instance constructed with an ill-formatted blob endpoint, the response fails with an empty error message. For example:

std::string blob_endpoint = "https://joetiledb.blob.core.windows.net";

auto account = std::make_shared<azure::storage_lite::storage_account>(
    account_name, credential, use_https, blob_endpoint);
auto client = std::make_shared<azure::storage_lite::blob_client>(account, 2);

std::future<azure::storage_lite::storage_outcome<void>> request =
  client->create_container("garbage");
assert(request.valid());
azure::storage_lite::storage_outcome<void> response = request.get();

if (!response.success()) {
  std::cerr << " response.error().code " << response.error().code  << std::endl;
  std::cerr << "response.error().code_name " << response.error().code_name  << std::endl;
  std::cerr << "response.error().message " << response.error().message  << std::endl;
}

The above prints:

response.error().code 706481520
response.error().code_name
response.error().message

Note that the error code is non-deterministic and I assume to be reading from uninitialized memory. Anyway, the non-obvious issue is that my blob end point is ill-formatted because it includes a https:// prefix. Removing that prefix works as expected. I assume the behavior would be identical with any sort of invalid blob endpoint string. The expected behavior is that the response.error().message would contain some sort of description indicating that the endpoint couldn't be reached, doesn't exist, etc.

Jinming-Hu commented 4 years ago

@joe-maley This should be fixed in the latest 0.3.0 release, feel free to reopen this issue if you have any further questions.