Ticket #3269: mc-3269-only-print-meaningful-error-code-v2.patch

File mc-3269-only-print-meaningful-error-code-v2.patch, 1.0 KB (added by and, 8 years ago)
  • lib/widget/wtools.c

    From f5151d05386d9e0b139686bdc8420974019e611e Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 3 Jan 2016 15:47:35 +0000
    Subject: [PATCH] fix #3269 only print meaningful error code
    
    v2: comment by andrew: prettify error code
    
    some error messages have no meaningful error code, don't display them
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/widget/wtools.c | 5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    
    diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c
    index 68f5a81..c4c4c20 100644
    a b mc_error_message (GError ** mcerror, int *code) 
    440440    if (mcerror == NULL || *mcerror == NULL) 
    441441        return FALSE; 
    442442 
    443     message (D_ERROR, MSG_ERROR, _("%d: %s"), (*mcerror)->code, (*mcerror)->message); 
     443    if ((*mcerror)->code == 0) 
     444        message (D_ERROR, MSG_ERROR, "%s", (*mcerror)->message); 
     445    else 
     446        message (D_ERROR, MSG_ERROR, "%s (%d)", (*mcerror)->message, (*mcerror)->code); 
    444447 
    445448    if (code != NULL) 
    446449        *code = (*mcerror)->code;