소스 검색

Improve error message in HangoutException.

Jelmer Vernooij 5 년 전
부모
커밋
1a3a792506
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      dulwich/errors.py

+ 8 - 2
dulwich/errors.py

@@ -134,8 +134,14 @@ class HangupException(GitProtocolError):
     """Hangup exception."""
 
     def __init__(self, stderr_lines=None):
-        super(HangupException, self).__init__(
-            "The remote server unexpectedly closed the connection.")
+        if stderr_lines:
+            super(HangupException, self).__init__(
+                '\n'.join(
+                    [line.decode('utf-8', 'surrogateescape')
+                     for line in stderr_lines]))
+        else:
+            super(HangupException, self).__init__(
+                "The remote server unexpectedly closed the connection.")
         self.stderr_lines = stderr_lines