lib/bb/data_smart.py: don't report variable in ExpansionError if not set

If the variable name is not specified then don't confuse the error message
by starting off with "Failure expanding variable None...".

(Bitbake rev: 9cb16f3c73751e7cf6d495586a6193f06eb97b1f)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2012-05-30 17:17:14 +01:00 committed by Richard Purdie
parent 5a975239ea
commit 64f88bf5d9
1 changed files with 4 additions and 1 deletions

View File

@ -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):