a0ae1f7e6a
Optimise, error handling and avoid some exploits
13 lignes
231 o
Go
13 lignes
231 o
Go
package util
|
|
|
|
import (
|
|
"net/http"
|
|
"runtime/debug"
|
|
|
|
"github.com/ewhal/nyaa/util/log"
|
|
)
|
|
|
|
func SendError(w http.ResponseWriter, err error, code int) {
|
|
log.Warnf("%s:\n%s\n", err, debug.Stack())
|
|
http.Error(w, err.Error(), code)
|
|
}
|