From 873633d8bc15fa50bf642e864b2953f66a4d74b2 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 19 Aug 2010 23:26:46 +0100 Subject: [PATCH] bitbake/utils.py: Give useful debug information when no lineno information is available Signed-off-by: Richard Purdie Signed-off-by: Chris Larson --- lib/bb/utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 546a72b377e..edc0f497588 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -313,13 +313,17 @@ def better_compile(text, file, realfile, mode = "exec"): # split the text into lines again body = text.split('\n') logger.error("Error in compiling python function in %s", realfile) - logger.error("The lines leading to this error were:") - logger.error("\t%d:%s:'%s'", e.lineno, e.__class__.__name__, body[e.lineno-1]) - - _print_trace(body, e.lineno) + logger.error(str(e)) + if e.lineno: + logger.error("The lines leading to this error were:") + logger.error("\t%d:%s:'%s'", e.lineno, e.__class__.__name__, body[e.lineno-1]) + _print_trace(body, e.lineno) + else: + logger.error("The function causing this error was:") + for line in body: + logger.error(line) - # exit now - sys.exit(1) + raise def better_exec(code, context, text, realfile = ""): """ -- 2.47.3