Skip to content

[FEATURE REQ] Throw FileNotFoundException when blob does not exist #45622

Open
@FredPraca

Description

@FredPraca

Is your feature request related to a problem? Please describe.
When building an InputStream with Files.newInputStream(myPath) from a Azure Blob Storage using azure-storage-blob-nio, if the blob does not exist, the exception thrown by AzureFileSystemProvider is IOException with the message:
Path either does not exist or points to a directory.Path must point to a file. Path: my_directory/my_path

Describe the solution you'd like
As according to the Blob API errors, there is a BlobNotFound error, which is obviously 404 HTTP code, it would be quite normal to expect a FileNotFound exception in return when the blob does not exist.

Describe alternatives you've considered
Solution I have used is to parse the error message and throw a FileNotFoundException if it contains a part of the message mentioned above and if not rethrow the _IOException

Additional context

  • Azure Storage Blob NIO version : 12.0.0-beta.31
  • Java 21

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions