Skip to content

Commit

Permalink
🌱 add stack info to osv-scanner error (#4172)
Browse files Browse the repository at this point in the history
* add stack info to osv-scanner error

Signed-off-by: Zxilly <zxilly@outlook.com>

* print error stack to stderr

Signed-off-by: Zxilly <zxilly@outlook.com>

* follow the lint rule

Signed-off-by: Zxilly <zxilly@outlook.com>

---------

Signed-off-by: Zxilly <zxilly@outlook.com>
  • Loading branch information
Zxilly authored Jun 14, 2024
1 parent c7821b6 commit 5ef9831
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clients/osv.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"context"
"errors"
"fmt"
"os"
"runtime/debug"

"github.com/google/osv-scanner/pkg/osvscanner"

Expand All @@ -39,6 +41,7 @@ func (v osvClient) ListUnfixedVulnerabilities(
defer func() {
if r := recover(); r != nil {
err = sce.CreateInternal(sce.ErrScorecardInternal, fmt.Sprintf("osv-scanner panic: %v", r))
fmt.Fprintf(os.Stderr, "osv-scanner panic: %v\n%s\n", r, string(debug.Stack()))
}
}()
directoryPaths := []string{}
Expand Down

0 comments on commit 5ef9831

Please sign in to comment.