diff options
author | Don Anderson <dda@ddanderson.com> | 2015-01-12 09:41:41 -0500 |
---|---|---|
committer | Don Anderson <dda@ddanderson.com> | 2015-01-12 09:41:41 -0500 |
commit | a82ddbe64ac5cf574827e90b6500f1254c164a33 (patch) | |
tree | 402195a14cce3465711a7b1a708ffe6e66095eb4 /lang/python/wiredtiger.i | |
parent | 652b95d09c8eb4f4f1c362f08f31e973614f5e91 (diff) | |
download | mongo-a82ddbe64ac5cf574827e90b6500f1254c164a33.tar.gz |
Raise an exception for any error, including WT_NOTFOUND,
returned from CURSOR->compare.
Diffstat (limited to 'lang/python/wiredtiger.i')
-rw-r--r-- | lang/python/wiredtiger.i | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i index 8eb1c59ee1e..de5afb0a0fa 100644 --- a/lang/python/wiredtiger.i +++ b/lang/python/wiredtiger.i @@ -363,10 +363,19 @@ retry: } %enddef -/* Cursor compare can return any of -1, 0, 1 or WT_NOTFOUND. */ +/* Cursor compare can return any of -1, 0, 1. */ %define COMPARE_OK(m) %exception m { $action + if (result < -1 || result > 1) + SWIG_ERROR_IF_NOT_SET(result); +} +%enddef + +/* Cursor compare can return any of -1, 0, 1 or WT_NOTFOUND. */ +%define COMPARE_NOTFOUND_OK(m) +%exception m { + $action if ((result < -1 || result > 1) && result != WT_NOTFOUND) SWIG_ERROR_IF_NOT_SET(result); } @@ -381,7 +390,7 @@ NOTFOUND_OK(__wt_cursor::search) NOTFOUND_OK(__wt_cursor::update) COMPARE_OK(__wt_cursor::compare) -COMPARE_OK(__wt_cursor::search_near) +COMPARE_NOTFOUND_OK(__wt_cursor::search_near) /* Lastly, some methods need no (additional) error checking. */ %exception __wt_connection::get_home; |