RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.
(out io.Writer, recovery ...RecoveryFunc)
| 43 | |
| 44 | // RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one. |
| 45 | func RecoveryWithWriter(out io.Writer, recovery ...RecoveryFunc) HandlerFunc { |
| 46 | if len(recovery) > 0 { |
| 47 | return CustomRecoveryWithWriter(out, recovery[0]) |
| 48 | } |
| 49 | return CustomRecoveryWithWriter(out, defaultHandleRecovery) |
| 50 | } |
| 51 | |
| 52 | // CustomRecoveryWithWriter returns a middleware for a given writer that recovers from any panics and calls the provided handle func to handle it. |
| 53 | func CustomRecoveryWithWriter(out io.Writer, handle RecoveryFunc) HandlerFunc { |