Skip to contentSkip to conversation

build.py: add unhandled exception information to the logger when executing python tasks

PATCH New Alexander Kanavin 1 participant 1 message Feb 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build.py: add unhandled exception information to the logger when executing python tasks

Previously this information was simply discarded, which in some cases resulted in generic, unhelpful failures.

With this change the user would see what the exception is, but without ugly tracebacks or bulky, irrelevant information from the log file.

---
 bitbake/lib/bb/build.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/build.py +2 -1
index 3e2a94edb11..7571421d71b 100644
@@ -304,9 +304,10 @@ def exec_func_python(func, d, runfile, cwd=None, pythonexception=False):
         utils.better_exec(comp, {"d": d}, code, "exec_python_func() autogenerated", pythonexception=pythonexception)
     except (bb.parse.SkipRecipe, bb.build.FuncFailed):
         raise
-    except:
+    except Exception as e:
         if pythonexception:
             raise
+        logger.error(str(e))
         raise FuncFailed(func, None)
     finally:
         bb.debug(2, "Python function %s finished" % func)
Signature · 1 line
2.17.1