Report panic context for SingletonContext.VisitAllModules
If a panic occurs in SingletonContext.VisitAllModules report the module that was being visited. Change-Id: Ia7fc07e2e33e9e3c0297903d3b06b7efb33f0105
This commit is contained in:
parent
0799fad550
commit
7f90d170b3
1 changed files with 12 additions and 1 deletions
|
@ -212,7 +212,18 @@ func (s *singletonContext) AddSubninja(file string) {
|
|||
}
|
||||
|
||||
func (s *singletonContext) VisitAllModules(visit func(Module)) {
|
||||
s.context.VisitAllModules(visit)
|
||||
var visitingModule Module
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
panic(newPanicErrorf(r, "VisitAllModules(%s) for module %s",
|
||||
funcName(visit), visitingModule))
|
||||
}
|
||||
}()
|
||||
|
||||
s.context.VisitAllModules(func(m Module) {
|
||||
visitingModule = m
|
||||
visit(m)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *singletonContext) VisitAllModulesIf(pred func(Module) bool,
|
||||
|
|
Loading…
Reference in a new issue