mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 23:08:22 -05:00
Don't put ops-related exceptions in log_q.
They're transient situations outside the app's domain and not bugs. (though they probably do indicate a place where we should be more robust, so don't ignore them entirely.)
This commit is contained in:
committed by
Logan Hanks
parent
f1c6f487ad
commit
5df49b5a38
@@ -20,6 +20,10 @@
|
||||
# CondeNet, Inc. All Rights Reserved.
|
||||
################################################################################
|
||||
|
||||
import _pylibmc
|
||||
import pycassa.pool
|
||||
import sqlalchemy.exc
|
||||
|
||||
from pylons import Response, c, g, request, session, config
|
||||
from pylons.controllers import WSGIController, Controller
|
||||
from pylons.controllers.util import abort
|
||||
@@ -30,6 +34,7 @@ from r2.lib.filters import spaceCompress, _force_unicode
|
||||
from r2.lib.template_helpers import get_domain
|
||||
from utils import storify, string2js, read_http_date
|
||||
from r2.lib.log import log_exception
|
||||
import r2.lib.db.thing
|
||||
|
||||
import re, hashlib
|
||||
from urllib import quote
|
||||
@@ -37,6 +42,16 @@ import urllib2
|
||||
import sys
|
||||
|
||||
|
||||
OPERATIONAL_EXCEPTIONS = (_pylibmc.MemcachedError,
|
||||
r2.lib.db.thing.NotFound,
|
||||
sqlalchemy.exc.OperationalError,
|
||||
sqlalchemy.exc.IntegrityError,
|
||||
pycassa.pool.AllServersUnavailable,
|
||||
pycassa.pool.NoConnectionAvailable,
|
||||
pycassa.pool.MaximumRetryException,
|
||||
)
|
||||
|
||||
|
||||
#TODO hack
|
||||
import logging
|
||||
from r2.lib.utils import UrlParser, query_string
|
||||
@@ -113,7 +128,7 @@ class BaseController(WSGIController):
|
||||
try:
|
||||
res = WSGIController.__call__(self, environ, start_response)
|
||||
except Exception as e:
|
||||
if g.exception_logging:
|
||||
if g.exception_logging and not isinstance(e, OPERATIONAL_EXCEPTIONS):
|
||||
try:
|
||||
log_exception(e, *sys.exc_info())
|
||||
except Exception as f:
|
||||
|
||||
Reference in New Issue
Block a user