Skip to content

Commit

Permalink
Define error::success so that error_codes exhibit proper 'truthiness'
Browse files Browse the repository at this point in the history
Right now if ec is assigned to key_not_found and then tested in a
conditional, the error code will not evaluate properly. This is
because key_not_found currently is set to 0 (first enum value).

Includes a 'success' error code similar to that defined in
boost::system:

https://www.boost.org/doc/libs/1_61_0/boost/system/error_code.hpp
  • Loading branch information
movitto authored and miguelportilla committed Jun 19, 2019
1 parent 79c1dca commit 2520aee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.0.2

* Add default success error_code to enum class error

---

2.0.1

* Fixed a bug introduced in 2.0 where flush time was incorrectly updated
Expand Down
6 changes: 6 additions & 0 deletions include/nudb/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ namespace errc = boost::system::errc;
/// Database error codes.
enum class error
{
/** Operation succeeded
Default error_code value.
*/
success = 0,

/** The specified key was not found.
Returned when @ref basic_store::fetch does not
Expand Down

0 comments on commit 2520aee

Please sign in to comment.