Chronos icon indicating copy to clipboard operation
Chronos copied to clipboard

Add more user-friendly errors

Open amit-davidson opened this issue 3 years ago • 2 comments

Enhancement

When the program panics the entire stack trace is returned. A more user friendly should be returned. It should contain the failing stacktrace but also the following messages as in the example stacktrace below (taken from that of the stdlib pointer package):

  • Internal panic in while performing analysis: at the top

  • Error in analysis (please report this bug) at the bottom

For that, a recover should be added to the start of the program and catch all panics and wrap them with the added messages.

Internal panic in while performing analysis:
goroutine 1 [running]:
runtime/debug.Stack(0x24, 0x0, 0x0)
        /usr/local/Cellar/go/1.15.3/libexec/src/runtime/debug/stack.go:24 +0x9f
runtime/debug.PrintStack()
        /usr/local/Cellar/go/1.15.3/libexec/src/runtime/debug/stack.go:16 +0x25
golang.org/x/tools/go/pointer.Analyze.func1(0xc05b607b00)
        /Users/amdavidson/go/pkg/mod/golang.org/x/[email protected]/go/pointer/analysis.go:227 +0x10b
panic(0x13502e0, 0xc03aff2380)
        /usr/local/Cellar/go/1.15.3/libexec/src/runtime/panic.go:969 +0x1b9
golang.org/x/tools/go/pointer.(*analysis).taggedValue(0xc042b7d340, 0xc00002acfd, 0x2, 0x64, 0xc00d7a8000)
        /Users/amdavidson/go/pkg/mod/golang.org/x/[email protected]/go/pointer/gen.go:272 +0x105
golang.org/x/tools/go/pointer.(*invokeConstraint).solve(0xc0499eb780, 0xc042b7d340, 0xc082a8e400)
        /Users/amdavidson/go/pkg/mod/golang.org/x/[email protected]/go/pointer/solve.go:317 +0x24e
golang.org/x/tools/go/pointer.(*analysis).solveConstraints(0xc042b7d340, 0xc049a7f620, 0xc082a8e400)
        /Users/amdavidson/go/pkg/mod/golang.org/x/[email protected]/go/pointer/solve.go:165 +0x178
golang.org/x/tools/go/pointer.(*analysis).solve(0xc042b7d340)
        /Users/amdavidson/go/pkg/mod/golang.org/x/[email protected]/go/pointer/solve.go:59 +0x1ad
golang.org/x/tools/go/pointer.Analyze(0xc042efc690, 0x0, 0x1437dc0, 0xc03aff2390)
        /Users/amdavidson/go/pkg/mod/golang.org/x/[email protected]/go/pointer/analysis.go:331 +0x4bc
github.com/amit-davidson/Chronos/pointerAnalysis.Analysis(0xc02ebbdb00, 0xc02e1361e0, 0xc042cd6f00, 0x5c, 0x60, 0x0, 0x7c)
        /Users/amdavidson/go/pkg/mod/github.com/amit-davidson/[email protected]/pointerAnalysis/PointerAnalysis.go:51 +0x38a
main.main()
        /Users/amdavidson/go/pkg/mod/github.com/amit-davidson/[email protected]/cmd/chronos/main.go:35 +0x473
Error in analysis (please report this bug)

amit-davidson avatar Nov 21 '20 13:11 amit-davidson

I can take this one!

shoniavika avatar Dec 08 '20 15:12 shoniavika

@shoniavika Feel free to take in the direction you feel like to. If you want to consult first, that's fine as well. You can reach me through the mail on my profile or here.

amit-davidson avatar Dec 08 '20 15:12 amit-davidson