package html import ( "bytes" "net/http" "strconv" ) func errorMessage(statusCode int) string { message := http.StatusText(statusCode) switch statusCode { case http.StatusMisdirectedRequest: message += " - domain not specified in .domains file" case http.StatusFailedDependency: message += " - target repo/branch doesn't exist or is private" } return message } // TODO: use template engine? func errorBody(statusCode int) []byte { return bytes.ReplaceAll(NotFoundPage, []byte("%status"), []byte(strconv.Itoa(statusCode)+" "+errorMessage(statusCode))) }