On Wednesday 07 June 2017 00:15:29 Damian Myerscough wrote:

> For example, if the ORM cannot query the database I would like to
> return a custom error message.
> 
> 
> ==> gunicorn.log <==
> [2017-06-07 06:06:01 +0000] [13] [DEBUG] GET /incidents/
> [2017-06-07 06:06:11 +0000] [8] [CRITICAL] WORKER TIMEOUT (pid:13)


>         try:
>             incidents =
> Incidents.objects.filter(user_and_team=request.user.client).exclude(st
> atus="Resolved") except OperationalError:
>             return JsonResponse(
>                 {"error": trans("We encountered a problem")},
>                 status=status.HTTP_503_SERVICE_UNAVAILABLE,
>             )
> 
> Any ideas?

Because your timeout hits before your code gets to except.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5295055.f5kFZ0N6pl%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to