Skip to content

Re-panic after recovering in Recovery middleware #37

Description

@ejholmes

I think recovering from panics in https://github.com/remind101/pkg/blob/master/httpx/middleware/recovery.go#L41-L51 should be an anti pattern, for a couple reasons:

  1. In general, it's bad practice to panic in the first place. Normal errors should be returned as an error type.
  2. It makes debugging panics in dev really annoying, because you don't get the full stack trace.

I think the recovery middleware still has value, it should recover from the panic, report it to the reporter, then re-panic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions