Show More
@@ -15,6 +15,8 b'' | |||
|
15 | 15 | # along with this program; if not, write to the Free Software Foundation, |
|
16 | 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
17 | 17 | |
|
18 | import sys | |
|
19 | import traceback | |
|
18 | 20 | import logging |
|
19 | 21 | import urlparse |
|
20 | 22 | |
@@ -80,3 +82,17 b' def obfuscate_qs(query_string):' | |||
|
80 | 82 | |
|
81 | 83 | return '&'.join('{}{}'.format( |
|
82 | 84 | k, '={}'.format(v) if v else '') for k, v in parsed) |
|
85 | ||
|
86 | ||
|
87 | def raise_from_original(new_type): | |
|
88 | """ | |
|
89 | Raise a new exception type with original args and traceback. | |
|
90 | """ | |
|
91 | exc_type, exc_value, exc_traceback = sys.exc_info() | |
|
92 | ||
|
93 | traceback.format_exception(exc_type, exc_value, exc_traceback) | |
|
94 | ||
|
95 | try: | |
|
96 | raise new_type(*exc_value.args), None, exc_traceback | |
|
97 | finally: | |
|
98 | del exc_traceback |
@@ -35,7 +35,7 b' from dulwich.server import update_server' | |||
|
35 | 35 | |
|
36 | 36 | from vcsserver import exceptions, settings, subprocessio |
|
37 | 37 | from vcsserver.utils import safe_str |
|
38 | from vcsserver.base import RepoFactory, obfuscate_qs | |
|
38 | from vcsserver.base import RepoFactory, obfuscate_qs, raise_from_original | |
|
39 | 39 | from vcsserver.hgcompat import ( |
|
40 | 40 | hg_url as url_parser, httpbasicauthhandler, httpdigestauthhandler) |
|
41 | 41 | |
@@ -58,6 +58,11 b' def reraise_safe_exceptions(func):' | |||
|
58 | 58 | raise exceptions.LookupException(e.message) |
|
59 | 59 | except (HangupException, UnexpectedCommandError) as e: |
|
60 | 60 | raise exceptions.VcsException(e.message) |
|
61 | except Exception as e: | |
|
62 | if not hasattr(e, '_vcs_kind'): | |
|
63 | log.exception("Unhandled exception in git remote call") | |
|
64 | raise_from_original(exceptions.UnhandledException) | |
|
65 | raise | |
|
61 | 66 | return wrapper |
|
62 | 67 | |
|
63 | 68 |
@@ -18,7 +18,6 b'' | |||
|
18 | 18 | import io |
|
19 | 19 | import logging |
|
20 | 20 | import stat |
|
21 | import sys | |
|
22 | 21 | import urllib |
|
23 | 22 | import urllib2 |
|
24 | 23 | |
@@ -28,7 +27,7 b' from mercurial import commands' | |||
|
28 | 27 | from mercurial import unionrepo |
|
29 | 28 | |
|
30 | 29 | from vcsserver import exceptions |
|
31 | from vcsserver.base import RepoFactory, obfuscate_qs | |
|
30 | from vcsserver.base import RepoFactory, obfuscate_qs, raise_from_original | |
|
32 | 31 | from vcsserver.hgcompat import ( |
|
33 | 32 | archival, bin, clone, config as hgconfig, diffopts, hex, |
|
34 | 33 | hg_url as url_parser, httpbasicauthhandler, httpdigestauthhandler, |
@@ -91,17 +90,6 b' def reraise_safe_exceptions(func):' | |||
|
91 | 90 | return wrapper |
|
92 | 91 | |
|
93 | 92 | |
|
94 | def raise_from_original(new_type): | |
|
95 | """ | |
|
96 | Raise a new exception type with original args and traceback. | |
|
97 | """ | |
|
98 | _, original, traceback = sys.exc_info() | |
|
99 | try: | |
|
100 | raise new_type(*original.args), None, traceback | |
|
101 | finally: | |
|
102 | del traceback | |
|
103 | ||
|
104 | ||
|
105 | 93 | class MercurialFactory(RepoFactory): |
|
106 | 94 | |
|
107 | 95 | def _create_config(self, config, hooks=True): |
@@ -17,12 +17,14 b'' | |||
|
17 | 17 | # along with this program; if not, write to the Free Software Foundation, |
|
18 | 18 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 | 19 | |
|
20 | import io | |
|
21 | import sys | |
|
22 | import json | |
|
23 | import logging | |
|
20 | 24 | import collections |
|
21 | 25 | import importlib |
|
22 | import io | |
|
23 | import json | |
|
24 | 26 | import subprocess |
|
25 | import sys | |
|
27 | ||
|
26 | 28 | from httplib import HTTPConnection |
|
27 | 29 | |
|
28 | 30 | |
@@ -33,6 +35,8 b' import simplejson as json' | |||
|
33 | 35 | |
|
34 | 36 | from vcsserver import exceptions |
|
35 | 37 | |
|
38 | log = logging.getLogger(__name__) | |
|
39 | ||
|
36 | 40 | |
|
37 | 41 | class HooksHttpClient(object): |
|
38 | 42 | connection = None |
@@ -105,6 +109,11 b' class GitMessageWriter(RemoteMessageWrit' | |||
|
105 | 109 | |
|
106 | 110 | def _handle_exception(result): |
|
107 | 111 | exception_class = result.get('exception') |
|
112 | exception_traceback = result.get('exception_traceback') | |
|
113 | ||
|
114 | if exception_traceback: | |
|
115 | log.error('Got traceback from remote call:%s', exception_traceback) | |
|
116 | ||
|
108 | 117 | if exception_class == 'HTTPLockedRC': |
|
109 | 118 | raise exceptions.RepositoryLockedException(*result['exception_args']) |
|
110 | 119 | elif exception_class == 'RepositoryError': |
@@ -33,7 +33,7 b' import svn.repos' | |||
|
33 | 33 | |
|
34 | 34 | from vcsserver import svn_diff |
|
35 | 35 | from vcsserver import exceptions |
|
36 | from vcsserver.base import RepoFactory | |
|
36 | from vcsserver.base import RepoFactory, raise_from_original | |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | log = logging.getLogger(__name__) |
@@ -62,17 +62,6 b' def reraise_safe_exceptions(func):' | |||
|
62 | 62 | return wrapper |
|
63 | 63 | |
|
64 | 64 | |
|
65 | def raise_from_original(new_type): | |
|
66 | """ | |
|
67 | Raise a new exception type with original args and traceback. | |
|
68 | """ | |
|
69 | _, original, traceback = sys.exc_info() | |
|
70 | try: | |
|
71 | raise new_type(*original.args), None, traceback | |
|
72 | finally: | |
|
73 | del traceback | |
|
74 | ||
|
75 | ||
|
76 | 65 | class SubversionFactory(RepoFactory): |
|
77 | 66 | |
|
78 | 67 | def _create_repo(self, wire, create, compatible_version): |
General Comments 0
You need to be logged in to leave comments.
Login now