Patchwork [bitbake-devel,1/5] lib/bb/data_smart.py: don't report variable in ExpansionError if not set

login
register
mail settings
Submitter Paul Eggleton
Date May 30, 2012, 4:17 p.m.
Message ID <b32bd1c30888569f45c7682b66c75e0504433e14.1338394341.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/28955/
State New
Headers show

Comments

Paul Eggleton - May 30, 2012, 4:17 p.m.
If the variable name is not specified then don't confuse the error message
by starting off with "Failure expanding variable None...".

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/data_smart.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 27fb7d9..2c02cde 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -102,7 +102,10 @@  class ExpansionError(Exception):
         self.expression = expression
         self.variablename = varname
         self.exception = exception
-        self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception)
+        if varname:
+            self.msg = "Failure expanding variable %s, expression was %s which triggered exception %s: %s" % (varname, expression, type(exception).__name__, exception)
+        else:
+            self.msg = "Failure expanding expression %s which triggered exception %s: %s" % (expression, type(exception).__name__, exception)
         Exception.__init__(self, self.msg)
         self.args = (varname, expression, exception)
     def __str__(self):