Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Documentation Should Include Expected Exceptions

See original GitHub issue

Which service(blob, file, queue) does this issue concern?


Which version of the SDK was used? Please provide the output of pip freeze.

azure-storage-blob v1.4.0

What problem was encountered?

The documentation for BaseBlobService does not include Exceptions that can be expected. For example, the get_blob_to_* methods simply state that they return a blob. But what happens if that Blob doesn’t exist? This can theoretically happen even if you first verify that the blob in question exists.

Have you found a mitigation/solution?

Run functions locally to see what exceptions are produced. [This is not very comprehensive.] In a simple test that consisted of calling get_blob_to_text with a known non-existent file, I found that it raises the azure.common.AzureMissingResourceHttpError exception (which is also not documented…?).

This is important because Python tends to be EAFP rather than LBYL and having well-documented exceptions helps enable a EAFP development approach.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

dsgoncommented, May 12, 2020

Hi. I’m working with this library and I detect that it is the same for cosmosdb.table.tableservice TableService (TableStorage) Any update about this?

zezha-msftcommented, Jan 11, 2019

Hi @ericdrobinson, thanks for reaching out and providing us feedbacks!

I’ve logged an item to improve the documentation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices for REST API Error Handling - Baeldung
Learn about some of the best practices for handling REST API errors, including useful approaches for providing users with additional ...
Read more >
How to document thrown exceptions in c#/.net - Stack Overflow
You should document every exception that might be thrown by your code, including those in any methods that you might call.
Read more >
Known Response Types throw Exception with wrapped ...
Exceptions should occur when an error condition occurs on the current code path, not when an expected response (this response is defined in...
Read more >
Exception Handling — Python 3.11.1 documentation
The functions described in this chapter will let you handle and raise Python exceptions. It is important to understand some of the basics...
Read more >
Expected Exceptions - WCF - Microsoft Learn
This sample demonstrates catching and handling the two expected exception types that correct programs must handle: TimeoutException and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found