Show More
@@ -21,6 +21,7 b'' | |||
|
21 | 21 | import inspect |
|
22 | 22 | import itertools |
|
23 | 23 | import logging |
|
24 | import sys | |
|
24 | 25 | import types |
|
25 | 26 | import fnmatch |
|
26 | 27 | |
@@ -38,6 +39,7 b' from rhodecode.api.exc import (' | |||
|
38 | 39 | from rhodecode.apps._base import TemplateArgs |
|
39 | 40 | from rhodecode.lib.auth import AuthUser |
|
40 | 41 | from rhodecode.lib.base import get_ip_addr, attach_context_attributes |
|
42 | from rhodecode.lib.exc_tracking import store_exception | |
|
41 | 43 | from rhodecode.lib.ext_json import json |
|
42 | 44 | from rhodecode.lib.utils2 import safe_str |
|
43 | 45 | from rhodecode.lib.plugins.utils import get_plugin_settings |
@@ -140,7 +142,6 b' def jsonrpc_error(request, message, reti' | |||
|
140 | 142 | def exception_view(exc, request): |
|
141 | 143 | rpc_id = getattr(request, 'rpc_id', None) |
|
142 | 144 | |
|
143 | fault_message = 'undefined error' | |
|
144 | 145 | if isinstance(exc, JSONRPCError): |
|
145 | 146 | fault_message = safe_str(exc.message) |
|
146 | 147 | log.debug('json-rpc error rpc_id:%s "%s"', rpc_id, fault_message) |
@@ -170,6 +171,10 b' def exception_view(exc, request):' | |||
|
170 | 171 | |
|
171 | 172 | fault_message = "No such method: {}. Similar methods: {}".format( |
|
172 | 173 | method, similar) |
|
174 | else: | |
|
175 | fault_message = 'undefined error' | |
|
176 | exc_info = exc.exc_info() | |
|
177 | store_exception(id(exc_info), exc_info, prefix='rhodecode-api') | |
|
173 | 178 | |
|
174 | 179 | return jsonrpc_error(request, fault_message, rpc_id) |
|
175 | 180 | |
@@ -292,8 +297,10 b' def request_view(request):' | |||
|
292 | 297 | raise |
|
293 | 298 | except Exception: |
|
294 | 299 | log.exception('Unhandled exception occurred on api call: %s', func) |
|
295 | return jsonrpc_error(request, retid=request.rpc_id, | |
|
296 | message='Internal server error') | |
|
300 | exc_info = sys.exc_info() | |
|
301 | store_exception(id(exc_info), exc_info, prefix='rhodecode-api') | |
|
302 | return jsonrpc_error( | |
|
303 | request, retid=request.rpc_id, message='Internal server error') | |
|
297 | 304 | |
|
298 | 305 | |
|
299 | 306 | def setup_request(request): |
@@ -414,8 +421,7 b' def add_jsonrpc_method(config, view, **k' | |||
|
414 | 421 | |
|
415 | 422 | if method is None: |
|
416 | 423 | raise ConfigurationError( |
|
417 | 'Cannot register a JSON-RPC method without specifying the ' | |
|
418 | '"method"') | |
|
424 | 'Cannot register a JSON-RPC method without specifying the "method"') | |
|
419 | 425 | |
|
420 | 426 | # we define custom predicate, to enable to detect conflicting methods, |
|
421 | 427 | # those predicates are kind of "translation" from the decorator variables |
@@ -524,6 +530,7 b' def includeme(config):' | |||
|
524 | 530 | |
|
525 | 531 | # match filter by given method only |
|
526 | 532 | config.add_view_predicate('jsonrpc_method', MethodPredicate) |
|
533 | config.add_view_predicate('jsonrpc_method_not_found', NotFoundPredicate) | |
|
527 | 534 | |
|
528 | 535 | config.add_renderer(DEFAULT_RENDERER, ExtJsonRenderer( |
|
529 | 536 | serializer=json.dumps, indent=4)) |
@@ -538,5 +545,4 b' def includeme(config):' | |||
|
538 | 545 | config.scan(plugin_module, ignore='rhodecode.api.tests') |
|
539 | 546 | # register some exception handling view |
|
540 | 547 | config.add_view(exception_view, context=JSONRPCBaseError) |
|
541 | config.add_view_predicate('jsonrpc_method_not_found', NotFoundPredicate) | |
|
542 | 548 | config.add_notfound_view(exception_view, jsonrpc_method_not_found=True) |
@@ -170,7 +170,7 b' def task_failure_signal(' | |||
|
170 | 170 | |
|
171 | 171 | # simulate sys.exc_info() |
|
172 | 172 | exc_info = (einfo.type, einfo.exception, einfo.tb) |
|
173 |
store_exception(id(exc_info), exc_info, prefix=' |
|
|
173 | store_exception(id(exc_info), exc_info, prefix='rhodecode-celery') | |
|
174 | 174 | |
|
175 | 175 | closer = celery_app.conf['PYRAMID_CLOSER'] |
|
176 | 176 | if closer: |
General Comments 0
You need to be logged in to leave comments.
Login now