##// 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 238 try:
239 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 242 except KeyError:
241 243 pass
242 244
@@ -249,8 +251,6 b' class VcsHttpProxy(object):'
249 251 CHUNK_SIZE = 16384
250 252
251 253 def __init__(self, server_and_port, backend_endpoint):
252
253
254 254 retries = Retry(total=5, connect=None, read=None, redirect=None)
255 255
256 256 adapter = requests.adapters.HTTPAdapter(max_retries=retries)
@@ -24,6 +24,7 b' Custom vcs exceptions module.'
24 24 import logging
25 25 import functools
26 26 import urllib2
27 import rhodecode
27 28
28 29 log = logging.getLogger(__name__)
29 30
@@ -180,17 +181,26 b' def map_vcs_exceptions(func):'
180 181 try:
181 182 return func(*args, **kwargs)
182 183 except Exception as e:
184 from rhodecode.lib.utils2 import str2bool
185 debug = str2bool(rhodecode.CONFIG.get('debug'))
186
183 187 # The error middleware adds information if it finds
184 188 # __traceback_info__ in a frame object. This way the remote
185 189 # traceback information is made available in error reports.
186 190 remote_tb = getattr(e, '_vcs_server_traceback', None)
191 org_remote_tb = getattr(e, '_vcs_server_org_exc_tb', '')
187 192 __traceback_info__ = None
188 193 if remote_tb:
189 194 if isinstance(remote_tb, basestring):
190 195 remote_tb = [remote_tb]
191 196 __traceback_info__ = (
192 'Found VCSServer remote traceback information:\n\n' +
193 '\n'.join(remote_tb))
197 'Found VCSServer remote traceback information:\n'
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 205 # Avoid that remote_tb also appears in the frame
196 206 del remote_tb
@@ -205,9 +215,9 b' def map_vcs_exceptions(func):'
205 215 args = e.args
206 216 else:
207 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 219 # for other than unhandled errors also log the traceback
210 # can be usefull for debugging
220 # can be useful for debugging
211 221 log.error(__traceback_info__)
212 222 raise _EXCEPTION_MAP[kind](*args)
213 223 else:
General Comments 0
You need to be logged in to leave comments. Login now