Patchwork error: store filename and message on LookupError for later

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 4, 2015, 9:58 p.m.
Message ID <9736657e2a52032e9f6c.1423087126@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7672/
State Accepted
Commit 10d02cd18604bf1f92167d61738504a41aee91a5
Headers show

Comments

Martin von Zweigbergk - Feb. 4, 2015, 9:58 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1423087055 28800
#      Wed Feb 04 13:57:35 2015 -0800
# Node ID 9736657e2a52032e9f6ccb5b578540dee0b69a3f
# Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
error: store filename and message on LookupError for later

It may be useful to be able to get to the failed path and the
underlying error message when catching a LookupError, so let's make
them accessible.
Matt Mackall - Feb. 4, 2015, 10:10 p.m.
On Wed, 2015-02-04 at 13:58 -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1423087055 28800
> #      Wed Feb 04 13:57:35 2015 -0800
> # Node ID 9736657e2a52032e9f6ccb5b578540dee0b69a3f
> # Parent  e1dbe0b215ae137eec53ceb12440536d570a83d2
> error: store filename and message on LookupError for later

Sure, queued for default.

Patch

diff -r e1dbe0b215ae -r 9736657e2a52 mercurial/error.py
--- a/mercurial/error.py	Mon Feb 02 19:58:41 2015 -0500
+++ b/mercurial/error.py	Wed Feb 04 13:57:35 2015 -0800
@@ -22,6 +22,8 @@ 
 class LookupError(RevlogError, KeyError):
     def __init__(self, name, index, message):
         self.name = name
+        self.index = index
+        self.message = message
         if isinstance(name, str) and len(name) == 20:
             from node import short
             name = short(name)