Skip to content

Proposal: Panic recovery #2

@rumyantseva

Description

@rumyantseva

Right now panic recovery looks like this:

if recovery := recover(); recovery != nil {
	if r.PanicHandler != nil {
		c := &Control{Request: req, Writer: w}
		r.PanicHandler(c)
	} else {
		log.Println("Recovered in handler:", req.Method, req.URL.Path)
	}
}

I like the idea of this solution, but unlucky this code misses recovery information, which might be helpful. I'd like to log recovery information or send it to r.PanicHandler. Is it possible to change this part of code somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions