From 1f185f329bb82c87b250fb2312ae873d69a20d38 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 22 Mar 2025 13:59:00 +0800 Subject: Use a custom errPage500 --- http_handle_repo_raw.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'http_handle_repo_raw.go') diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go index db20791..6b69720 100644 --- a/http_handle_repo_raw.go +++ b/http_handle_repo_raw.go @@ -26,16 +26,16 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params params["path_spec"] = pathSpec if refHash, err = getRefHash(repo, params["ref_type"].(string), params["ref_name"].(string)); err != nil { - http.Error(writer, "Error getting ref hash: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error getting ref hash: "+err.Error()) return } if commitObj, err = repo.CommitObject(refHash); err != nil { - http.Error(writer, "Error getting commit object: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error getting commit object: "+err.Error()) return } if tree, err = commitObj.Tree(); err != nil { - http.Error(writer, "Error getting file tree: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error getting file tree: "+err.Error()) return } @@ -47,14 +47,14 @@ func httpHandleRepoRaw(writer http.ResponseWriter, request *http.Request, params var file *object.File var fileContent string if file, err = tree.File(pathSpec); err != nil { - http.Error(writer, "Error retrieving path: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error retrieving path: "+err.Error()) return } if redirectNoDir(writer, request) { return } if fileContent, err = file.Contents(); err != nil { - http.Error(writer, "Error reading file: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error reading file: "+err.Error()) return } fmt.Fprint(writer, fileContent) -- cgit v1.2.3