Skip to content

Add more user-friendly errors #35

Open
@amit-davidson

Description

@amit-davidson

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions