aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-01-23 20:33:43 +0100
committerGitHub <noreply@github.com>2021-01-23 21:33:43 +0200
commit4acb499f307069b893ee5df59446f5b0d1b3bb31 (patch)
treef42245a8ecd7999072eb049eca4b49f421ab37d7
parent800c436b0b99806a9a8db7216d77a082ae267ffd (diff)
downloadgitea-4acb499f307069b893ee5df59446f5b0d1b3bb31.tar.gz
gitea-4acb499f307069b893ee5df59446f5b0d1b3bb31.zip
just overload to not get it by mistake again ... (#14440)
-rw-r--r--modules/context/api.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index aa4b6b9e89..7771ec1b14 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -73,6 +73,11 @@ type APIRedirect struct{}
// swagger:response string
type APIString string
+// ServerError responds with error message, status is 500
+func (ctx *APIContext) ServerError(title string, err error) {
+ ctx.Error(http.StatusInternalServerError, title, err)
+}
+
// Error responds with an error message to client with given obj as the message.
// If status is 500, also it prints error to log.
func (ctx *APIContext) Error(status int, title string, obj interface{}) {