state-hiu / ittc-server-django

Front-End ITTC Server with Proxy, Cache, Logs, and Stats
MIT License
0 stars 3 forks source link

HTTP Error Handling / Request error log #16

Open state-hiu opened 9 years ago

state-hiu commented 9 years ago

try/except for HTTP get error and just return immediately instead of erroring out (maybe create separate request_error log).

[2015-04-28 06:30:23,096: ERROR/MainProcess] Task ittc.cache.tasks.taskRequestTile[ecf2ef0c-3c55-4598-9db1-ffbdd529f6b9] raised unexpected: IOError()
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 355, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/trace.py", line 596, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/ubuntu/ittc-server-django.git/ittc/cache/tasks.py", line 79, in taskRequestTile
    tile = tilesource.requestTile(ix,iyf,iz,ext,True)
  File "/home/ubuntu/ittc-server-django.git/ittc/source/models.py", line 204, in requestTile
    request = make_request(url=url, params=params, auth=None, data=None, contentType=contentType)
  File "/home/ubuntu/ittc-server-django.git/ittc/source/models.py", line 62, in make_request
    return urllib2.urlopen(req)
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError
@