No status codes on simple operations
See original GitHub issueThe rocksdb cpp library returns a Status object for each operation. Unfortunately, operations such as Put or Delete don’t seem to return anything when the operation fails. For example, if I do the following:
import rocksdb
# Create an entirely new database
db = rocksdb.DB("/tmp/foo", rocksdb.Options(create_if_missing=True))
result = db.delete("blah")
print(result)
result
is None. No exceptions are raised.
This makes it hard to build an API that responds to failures or unexpected events. For example, I may want to take a different path if I try to delete an object which does not exist. Of course, I could try to get it first, and if that fails, then error out, but that’s not very efficient.
Would it be possible to extend the API somehow to allow this?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
A Complete Guide and List of HTTP Status Codes
A complete list of HTTP status codes with explaination of what they are, why they occur and what you can do to fix...
Read more >Controlling HTTP Status Codes | Integration Broker
Controlling HTTP Status Codes. Base Service Operation Overview; 2xx Examples. 200 Response; 202 Response; 203 Non-Authoritative Information; 204 No Content ...
Read more >Which HTTP Status Code to Use for Every CRUD App - Moesif
This guide walks through the various CRUD operations and which status codes you should be using for clean API design.
Read more >HTTP Status Codes - REST API Tutorial
This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty...
Read more >HTTP Status Codes List | HTTP Error Codes Explained
Learn about all the HTTP status codes. Read about the HTTP status codes and their descriptions. Quickly understand client and server errors.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please see the branch
pybind11
. Now every transaction returns the status. And more information are going to update in the document.Ah, I see. For example, this function is called if the error is not “not found” for get(): https://github.com/twmht/python-rocksdb/blob/98910c2dce41c02aaa1745ae09e9d5fcdde34bdd/rocksdb/_rocksdb.pyx#L67
And it raises one of the errors there. I guess it’s unclear how the state of the DB maps to those. That said, the actual rocksdb documentation doesn’t seem to make that clear either. 😦
Should we update this issue to ask for a docs update? Or should I just open a new one?