Patchwork [hglib] error: show more info on CommandError's __str__

login
register
mail settings
Submitter Idan Kamara
Date June 14, 2013, 3:39 p.m.
Message ID <59cb26bf866e793b1848.1371224395@idan>
Download mbox | patch
Permalink /patch/1729/
State Accepted, archived
Delegated to: Matt Mackall
Headers show

Comments

Idan Kamara - June 14, 2013, 3:39 p.m.
# HG changeset patch
# User Idan Kamara <idankk86@gmail.com>
# Date 1371224216 -10800
#      Fri Jun 14 18:36:56 2013 +0300
# Node ID 59cb26bf866e793b184842ad23f82fc3551d1742
# Parent  661f78f395eab8fc1617e30a0905db8b38c8e27b
error: show more info on CommandError's __str__

Sometimes stderr doesn't contain anything which makes the current
__str__ useless. We now return a tuple of (exit code, output, error).
Matt Mackall - June 20, 2013, 7:25 p.m.
On Fri, 2013-06-14 at 18:39 +0300, Idan Kamara wrote:
> # HG changeset patch
> # User Idan Kamara <idankk86@gmail.com>
> # Date 1371224216 -10800
> #      Fri Jun 14 18:36:56 2013 +0300
> # Node ID 59cb26bf866e793b184842ad23f82fc3551d1742
> # Parent  661f78f395eab8fc1617e30a0905db8b38c8e27b
> error: show more info on CommandError's __str__

Queued for hglib, thanks.

Patch

diff --git a/hglib/error.py b/hglib/error.py
--- a/hglib/error.py
+++ b/hglib/error.py
@@ -6,7 +6,7 @@ 
         self.err = err
 
     def __str__(self):
-        return self.err
+        return str((self.ret, self.out.rstrip(), self.err.rstrip()))
 
 class ServerError(Exception):
     pass