fix: improve panic management (#3710)
This commit is contained in:
parent
e394120f53
commit
076f6b911d
@ -98,6 +98,13 @@ func (act *action) waitUntilDependingAnalyzersWorked() {
|
||||
func (act *action) analyzeSafe() {
|
||||
defer func() {
|
||||
if p := recover(); p != nil {
|
||||
if !act.isroot {
|
||||
// This line allows to display "hidden" panic with analyzers like buildssa.
|
||||
// Some linters are dependent of sub-analyzers but when a sub-analyzer fails the linter is not aware of that,
|
||||
// this results to another panic (ex: "interface conversion: interface {} is nil, not *buildssa.SSA").
|
||||
act.r.log.Errorf("%s: panic during analysis: %v, %s", act.a.Name, p, string(debug.Stack()))
|
||||
}
|
||||
|
||||
act.err = errorutil.NewPanicError(fmt.Sprintf("%s: package %q (isInitialPkg: %t, needAnalyzeSource: %t): %s",
|
||||
act.a.Name, act.pkg.Name, act.isInitialPkg, act.needAnalyzeSource, p), debug.Stack())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user