TestNew | Basic fallback middleware creation | Returns custom error message when handler errors |
TestWithOptions_CatchPanic | Panic recovery with custom handler | Catches panic and returns custom response with 500 status |
TestWithOptions_DefaultMessage | Default message without custom handler | Returns configured default message on error |
TestWithOptions_NoError | Successful request handling | Passes through successful responses without triggering fallback |
TestDefault | Default text fallback | Returns simple text message on error |
TestJSON | JSON error responses | Returns JSON-formatted error with proper content type |
TestRedirect | Redirect on error | Redirects to specified URL with correct status code |
TestChain | Chained fallback handlers | Tries handlers in order, uses first that handles the error |
TestChain_NoHandlerMatches | Chain with no matches | Returns default “An error occurred” message |
TestPanicWithError | Panic with error type | Catches error panic and formats message correctly |
TestPanicWithNonError | Panic with non-error type | Converts non-error panic to “panic occurred” message |
TestPanicWithDefaultHandler | Panic without custom handler | Uses default message when no custom handler provided |
TestNotFound | 404 not found handling | Triggers custom handler on 404 status |
TestForStatus | Status code-specific handling | Creates middleware for specific status codes |
TestWithOptions_DefaultsUsed | Default configuration values | Uses “An error occurred” when no config provided |
TestResponseCapture_WriteHeader | Response status capturing | Captures first status code, ignores subsequent writes |
TestResponseCapture_Write | Response write interception | Sets status to 200 on first write if not set |
TestPanicError_ErrorMethod | Panic error type behavior | Correctly formats error messages for different panic types |