Skip to content

[C++][FS][Azure] Remove StatusFromErrorResponse as it's not necessary #39718

@felipecrv

Description

@felipecrv

Describe the enhancement requested

Only the "*IfExists" functions from the Azure SDK ever set response.Value.Deleted to false to indicate that a resource wasn't found and the request succeeded without deleting anything.

This is the implementation of DataLakePathClient::DeleteIfExists:

  Azure::Response<Models::DeletePathResult> DataLakePathClient::DeleteIfExists(
      const DeletePathOptions& options,
      const Azure::Core::Context& context) const
  {
    try
    {
      return Delete(options, context);
    }
    catch (StorageException& e)
    {
      if (e.ErrorCode == _detail::DataLakeFilesystemNotFound
          || e.ErrorCode == _detail::DataLakePathNotFound)
      {
        Models::DeletePathResult ret;
        ret.Deleted = false;
        return Azure::Response<Models::DeletePathResult>(std::move(ret), std::move(e.RawResponse));
      }
      throw;
    }
  }

It's better that we use the Delete() versions of these functions instead of DeleteIfExists and check the ErrorCode ourselves to return an appropriate Status instead of something generic.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions