mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-11 01:50:27 +08:00
改进RPC相关提示
This commit is contained in:
@@ -3,6 +3,7 @@ package actionutils
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
|
||||||
|
rpcerrors "github.com/TeaOSLab/EdgeCommon/pkg/rpc/errors"
|
||||||
"github.com/iwind/TeaGo/actions"
|
"github.com/iwind/TeaGo/actions"
|
||||||
"github.com/iwind/TeaGo/logs"
|
"github.com/iwind/TeaGo/logs"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -26,6 +27,7 @@ func FailPage(action actions.ActionWrapper, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logs.Println("[" + reflect.TypeOf(action).String() + "]" + findStack(err.Error()))
|
logs.Println("[" + reflect.TypeOf(action).String() + "]" + findStack(err.Error()))
|
||||||
}
|
}
|
||||||
|
err = rpcerrors.HumanError(err)
|
||||||
action.Object().ResponseWriter.WriteHeader(http.StatusInternalServerError)
|
action.Object().ResponseWriter.WriteHeader(http.StatusInternalServerError)
|
||||||
if len(action.Object().Request.Header.Get("X-Requested-With")) > 0 {
|
if len(action.Object().Request.Header.Get("X-Requested-With")) > 0 {
|
||||||
action.Object().WriteString(teaconst.ErrServer)
|
action.Object().WriteString(teaconst.ErrServer)
|
||||||
|
|||||||
Reference in New Issue
Block a user