Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (17 sloc) 408 Bytes
package silence
import (
"mango"
)
func SilenceErrors(env mango.Env, app mango.App) (mango.Status, mango.Headers, mango.Body) {
// Call our upstream app
status, headers, body := app.Call(env)
// If we got an error
if status == 500 {
// Silence it!
status = 200
headers = mango.Headers{}
body = "Silence is golden!"
}
// Pass the response back to the client
return status, headers, body
}
Something went wrong with that request. Please try again.