From 02b99d6e448ae5e72692fc7c86ca8c55a1a16efe Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 5 Apr 2021 08:18:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/web/actions/actionutils/utils.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/web/actions/actionutils/utils.go b/internal/web/actions/actionutils/utils.go index 056cbba6..c549b1e9 100644 --- a/internal/web/actions/actionutils/utils.go +++ b/internal/web/actions/actionutils/utils.go @@ -5,6 +5,7 @@ import ( teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const" "github.com/iwind/TeaGo/actions" "github.com/iwind/TeaGo/logs" + "net/http" "os" "path/filepath" "reflect" @@ -25,7 +26,21 @@ func FailPage(action actions.ActionWrapper, err error) { if err != nil { logs.Println("[" + reflect.TypeOf(action).String() + "]" + findStack(err.Error())) } - action.Object().WriteString(teaconst.ErrServer) + action.Object().ResponseWriter.WriteHeader(http.StatusInternalServerError) + if len(action.Object().Request.Header.Get("X-Requested-With")) > 0 { + action.Object().WriteString(teaconst.ErrServer) + } else { + action.Object().WriteString(` + + + +
+ ` + teaconst.ErrServer + ` +
可以通过查看 $安装目录/logs/run.log 日志文件查看具体的错误提示。
+
+ +`) + } } // 判断动作的文件路径是否相当