Wrap panics that occur in AndroidMkDataProviders
Annotate panics that come from an AndroidMkDataProvider with the
module and variant that it was running on.
Test: m checkbuild
Change-Id: I4a2f32b1987dc028c446e9379a0738059e7679b1
diff --git a/android/androidmk.go b/android/androidmk.go
index 1d11161..44c266a 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -141,6 +141,13 @@
}
func translateAndroidMkModule(ctx SingletonContext, w io.Writer, mod blueprint.Module) error {
+ defer func() {
+ if r := recover(); r != nil {
+ panic(fmt.Errorf("%s in translateAndroidMkModule for module %s variant %s",
+ r, ctx.ModuleName(mod), ctx.ModuleSubDir(mod)))
+ }
+ }()
+
provider, ok := mod.(AndroidMkDataProvider)
if !ok {
return nil