question-mark
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.

No status codes on simple operations

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
twmhtcommented, Apr 19, 2019

Please see the branch pybind11. Now every transaction returns the status. And more information are going to update in the document.

0reactions
klarosecommented, Nov 7, 2018

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?

Read more comments on GitHub >

github_iconTop 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 >

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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found