##// END OF EJS Templates
exceptions: show original remote traceback, and more info if debug is enabled.
marcink -
r3369:ba0393a0 default
parent child Browse files
Show More
@@ -237,6 +237,8 b' def _remote_call(url, payload, exception'
237
237
238 try:
238 try:
239 exc._vcs_server_traceback = error['traceback']
239 exc._vcs_server_traceback = error['traceback']
240 exc._vcs_server_org_exc_name = error['org_exc']
241 exc._vcs_server_org_exc_tb = error['org_exc_tb']
240 except KeyError:
242 except KeyError:
241 pass
243 pass
242
244
@@ -249,8 +251,6 b' class VcsHttpProxy(object):'
249 CHUNK_SIZE = 16384
251 CHUNK_SIZE = 16384
250
252
251 def __init__(self, server_and_port, backend_endpoint):
253 def __init__(self, server_and_port, backend_endpoint):
252
253
254 retries = Retry(total=5, connect=None, read=None, redirect=None)
254 retries = Retry(total=5, connect=None, read=None, redirect=None)
255
255
256 adapter = requests.adapters.HTTPAdapter(max_retries=retries)
256 adapter = requests.adapters.HTTPAdapter(max_retries=retries)
@@ -24,6 +24,7 b' Custom vcs exceptions module.'
24 import logging
24 import logging
25 import functools
25 import functools
26 import urllib2
26 import urllib2
27 import rhodecode
27
28
28 log = logging.getLogger(__name__)
29 log = logging.getLogger(__name__)
29
30
@@ -180,17 +181,26 b' def map_vcs_exceptions(func):'
180 try:
181 try:
181 return func(*args, **kwargs)
182 return func(*args, **kwargs)
182 except Exception as e:
183 except Exception as e:
184 from rhodecode.lib.utils2 import str2bool
185 debug = str2bool(rhodecode.CONFIG.get('debug'))
186
183 # The error middleware adds information if it finds
187 # The error middleware adds information if it finds
184 # __traceback_info__ in a frame object. This way the remote
188 # __traceback_info__ in a frame object. This way the remote
185 # traceback information is made available in error reports.
189 # traceback information is made available in error reports.
186 remote_tb = getattr(e, '_vcs_server_traceback', None)
190 remote_tb = getattr(e, '_vcs_server_traceback', None)
191 org_remote_tb = getattr(e, '_vcs_server_org_exc_tb', '')
187 __traceback_info__ = None
192 __traceback_info__ = None
188 if remote_tb:
193 if remote_tb:
189 if isinstance(remote_tb, basestring):
194 if isinstance(remote_tb, basestring):
190 remote_tb = [remote_tb]
195 remote_tb = [remote_tb]
191 __traceback_info__ = (
196 __traceback_info__ = (
192 'Found VCSServer remote traceback information:\n\n' +
197 'Found VCSServer remote traceback information:\n'
193 '\n'.join(remote_tb))
198 '{}\n'
199 '+++ BEG SOURCE EXCEPTION +++\n\n'
200 '{}\n'
201 '+++ END SOURCE EXCEPTION +++\n'
202 ''.format('\n'.join(remote_tb), org_remote_tb)
203 )
194
204
195 # Avoid that remote_tb also appears in the frame
205 # Avoid that remote_tb also appears in the frame
196 del remote_tb
206 del remote_tb
@@ -205,9 +215,9 b' def map_vcs_exceptions(func):'
205 args = e.args
215 args = e.args
206 else:
216 else:
207 args = [__traceback_info__ or 'unhandledException']
217 args = [__traceback_info__ or 'unhandledException']
208 if __traceback_info__ and kind not in ['unhandled', 'lookup']:
218 if debug or __traceback_info__ and kind not in ['unhandled', 'lookup']:
209 # for other than unhandled errors also log the traceback
219 # for other than unhandled errors also log the traceback
210 # can be usefull for debugging
220 # can be useful for debugging
211 log.error(__traceback_info__)
221 log.error(__traceback_info__)
212 raise _EXCEPTION_MAP[kind](*args)
222 raise _EXCEPTION_MAP[kind](*args)
213 else:
223 else:
General Comments 0
You need to be logged in to leave comments. Login now