Show nice traceback on panic. (Web Development)

I develop with Python/Django since ages. One thing I love is the django debug page:

To understand unknown code I often add “assert 0, myvar” to the code, then call the view,
and then look the debug page and have a look at myvar and the stacktrace.

Is there something similar in golang?

I could add panic(myvar) into a line, and then I would like to see a traceback in the browser,
and (this would be super great) if I could see the local variables of each call-frame.

Your endpoint handler could recover from panic and return the stack trace to the client. runtime package - runtime - Go Packages. This might get you started Go Playground - The Go Programming Language

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.