diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-22 13:59:00 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-22 13:59:00 +0800 |
commit | 1f185f329bb82c87b250fb2312ae873d69a20d38 (patch) | |
tree | 892ad487e7e1154fcb71fbe05acf9e583592e96b /http_handle_repo_commit.go | |
parent | Variable name lengths (diff) | |
download | forge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.gz forge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.zst forge-1f185f329bb82c87b250fb2312ae873d69a20d38.zip |
Use a custom errPage500
Diffstat (limited to '')
-rw-r--r-- | http_handle_repo_commit.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/http_handle_repo_commit.go b/http_handle_repo_commit.go index b3c2172..c15ae7d 100644 --- a/http_handle_repo_commit.go +++ b/http_handle_repo_commit.go @@ -44,13 +44,13 @@ func httpHandleRepoCommit(writer http.ResponseWriter, request *http.Request, par commitIDStrSpecNoSuffix = strings.TrimSuffix(commitIDStrSpec, ".patch") commitID = plumbing.NewHash(commitIDStrSpecNoSuffix) if commitObj, err = repo.CommitObject(commitID); err != nil { - http.Error(writer, "Error getting commit object: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error getting commit object: "+err.Error()) return } if commitIDStrSpecNoSuffix != commitIDStrSpec { var patchStr string if patchStr, err = fmtCommitPatch(commitObj); err != nil { - http.Error(writer, "Error formatting patch: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error formatting patch: "+err.Error()) return } fmt.Fprintln(writer, patchStr) @@ -68,7 +68,7 @@ func httpHandleRepoCommit(writer http.ResponseWriter, request *http.Request, par parentCommitHash, patch, err = fmtCommitAsPatch(commitObj) if err != nil { - http.Error(writer, "Error getting patch from commit: "+err.Error(), http.StatusInternalServerError) + errorPage500(writer, params, "Error getting patch from commit: "+err.Error()) return } params["parent_commitHash"] = parentCommitHash.String() |