Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pymongo errors aren't propagated properly #20

Open
odedfos opened this issue Dec 6, 2016 · 0 comments
Open

pymongo errors aren't propagated properly #20

odedfos opened this issue Dec 6, 2016 · 0 comments
Labels

Comments

@odedfos
Copy link

odedfos commented Dec 6, 2016

Errors originating from the pymongo driver aren't properly propagated to the application.

For instance, when performing a geospatial query when there is no 2dsphere index on the collection, I get the following error:

File "/project/env/local/lib/python2.7/site-packages/pymongo/cursor.py", line 977, in next
      if len(self.__data) or self._refresh():
File "/project/env/local/lib/python2.7/site-packages/pymongo/cursor.py", line 902, in _refresh
      self.__read_preference))
File "/project/env/local/lib/python2.7/site-packages/pymongo/cursor.py", line 839, in __send_message
      codec_options=self.__codec_options)
File "/project/env/local/lib/python2.7/site-packages/pymongo/helpers.py", line 112, in _unpack_response
      error_object = bson.BSON(response[20:]).decode()
AttributeError: 'module' object has no attribute 'BSON'

When I disable cbson with:
os.environ['MONGOKAT_DISABLE_CBSON'] = "1"

I get the proper error:

  File "/project/env/local/lib/python2.7/site-packages/pymongo/cursor.py", line 977, in next
    if len(self.__data) or self._refresh():
  File "/project/env/local/lib/python2.7/site-packages/pymongo/cursor.py", line 902, in _refresh
    self.__read_preference))
  File "/project/env/local/lib/python2.7/site-packages/pymongo/cursor.py", line 839, in __send_message
    codec_options=self.__codec_options)
  File "/project/env/local/lib/python2.7/site-packages/pymongo/helpers.py", line 122, in _unpack_response
    error_object)
OperationFailure: database error: error processing query: ns=test_test.pl_venue ntoreturn=100
Tree: GEONEAR  field=geolocation maxdist=100 isNearSphere=0
Sort: {}
Proj: {}
 planner returned error: unable to find index for $geoNear query

requirements:
pymongo==3.0.3
mongokat==0.1.4

@sylvinus sylvinus added the bug label Dec 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants