mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-19 16:21:43 +01:00
v0.5.0-rc5: check release
This commit is contained in:
@@ -9,14 +9,14 @@ import (
|
||||
E "github.com/yusing/go-proxy/error"
|
||||
)
|
||||
|
||||
func HandleErr(w http.ResponseWriter, r *http.Request, err error, code ...int) {
|
||||
err = E.From(err).Subjectf("%s %s", r.Method, r.URL)
|
||||
func HandleErr(w http.ResponseWriter, r *http.Request, origErr error, code ...int) {
|
||||
err := E.From(origErr).Subjectf("%s %s", r.Method, r.URL)
|
||||
logrus.WithField("module", "api").Error(err)
|
||||
if len(code) > 0 {
|
||||
http.Error(w, err.Error(), code[0])
|
||||
http.Error(w, err.String(), code[0])
|
||||
return
|
||||
}
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
http.Error(w, err.String(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
func ErrMissingKey(k string) error {
|
||||
|
||||
@@ -44,7 +44,7 @@ func ReloadServer() E.NestedError {
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return E.Failure("server reload").Subjectf("status code: %v", resp.StatusCode)
|
||||
}
|
||||
return E.Nil()
|
||||
return nil
|
||||
}
|
||||
|
||||
var HttpClient = &http.Client{
|
||||
|
||||
Reference in New Issue
Block a user