mirror of
https://github.com/gogs/gogs.git
synced 2025-12-22 16:20:14 +01:00
api: overhaul /repos/owner/repos/contents (#5980)
* Fix import path renaming * api: overhaul /repos/owner/repos/contents
This commit is contained in:
@@ -39,7 +39,7 @@ func (c *APIContext) Error(status int, title string, obj interface{}) {
|
||||
}
|
||||
|
||||
if status == http.StatusInternalServerError {
|
||||
log.Error("%s: %s", title, message)
|
||||
log.ErrorDepth(5, "%s: %s", title, message)
|
||||
}
|
||||
|
||||
c.JSON(status, map[string]string{
|
||||
@@ -63,6 +63,11 @@ func (c *APIContext) ServerError(title string, err error) {
|
||||
c.Error(http.StatusInternalServerError, title, err)
|
||||
}
|
||||
|
||||
// Errorf renders the 500 response with formatted message.
|
||||
func (c *APIContext) Errorf(err error, format string, args ...interface{}) {
|
||||
c.Error(http.StatusInternalServerError, fmt.Sprintf(format, args...), err)
|
||||
}
|
||||
|
||||
// NotFoundOrServerError use error check function to determine if the error
|
||||
// is about not found. It responses with 404 status code for not found error,
|
||||
// or error context description for logging purpose of 500 server error.
|
||||
|
||||
Reference in New Issue
Block a user