On Jan 14, 11:11 pm, Alexander Kojevnikov <alexan...@kojevnikov.com>
wrote:
> > Is there any way to catch the timeout error specifically? That way it
> > doesn't bother to retry if something else is the problem.
>
> Sure, just replace "except" with "except db.Timeout"


Oh ok.. so it is possible to catch that. It's datastore.Timeout and
not db.Timeout, right? I was confused because when I see it in the
logs I saw: raise _ToDatastoreError(err), so I wasn't sure how to
catch it since that exception covers pretty much any issue with
writing to the datastore, not just timeouts. (Sorry, I didn't start
using python until I started using appengine, so still learning here)

example:

<class 'google.appengine.api.datastore_errors.Timeout'>: datastore
timeout: operation took too long.
Traceback (most recent call last):
  File "/base/data/home/apps/fanatasticweb/1.330570312771074300/common/
appenginepatch/main.py", line 26, in real_main
    util.run_wsgi_app(application)
  File "/base/python_lib/versions/1/google/appengine/ext/webapp/
util.py", line 76, in run_wsgi_app
    result = application(env, _start_response)
  File "/base/data/home/apps/fanatasticweb/1.330570312771074300/common/
zip-packages/django.zip/django/core/handlers/wsgi.py", line 239, in
__call__
  File "/base/data/home/apps/fanatasticweb/1.330570312771074300/common/
zip-packages/django.zip/django/core/handlers/base.py", line 67, in
get_response
  File "/base/data/home/apps/fanatasticweb/1.330570312771074300/common/
appengine_utilities/django-middleware/middleware.py", line 12, in
process_request
    request.session = sessions.Session()
  File "/base/data/home/apps/fanatasticweb/1.330570312771074300/common/
appengine_utilities/sessions.py", line 207, in __init__
    self.session.put()
  File "/base/python_lib/versions/1/google/appengine/ext/db/
__init__.py", line 657, in put
    return datastore.Put(self._entity)
  File "/base/python_lib/versions/1/google/appengine/api/
datastore.py", line 162, in Put
    raise _ToDatastoreError(err)
  File "/base/python_lib/versions/1/google/appengine/api/
datastore.py", line 1637, in _ToDatastoreError
    raise errors[err.application_error](err.error_detail)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to