mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-7 Removing AppError ctor
This commit is contained in:
@@ -73,7 +73,9 @@ func logClient(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if lvl == "ERROR" {
|
||||
err := model.NewAppError("client", msg, "")
|
||||
err := &model.AppError{}
|
||||
err.Message = msg
|
||||
err.Where = "client"
|
||||
c.LogError(err)
|
||||
}
|
||||
|
||||
|
||||
@@ -65,13 +65,13 @@ func addLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
license = model.LicenseFromJson(strings.NewReader(licenseStr))
|
||||
|
||||
if result := <-Srv.Store.User().AnalyticsUniqueUserCount(""); result.Err != nil {
|
||||
c.Err = model.NewAppError("addLicense", "Unable to count total unique users.", fmt.Sprintf("err=%v", result.Err.Error()))
|
||||
c.Err = model.NewLocAppError("addLicense", api.license.add_license.invalid_count.app_error, nil, result.Err.Error())
|
||||
return
|
||||
} else {
|
||||
uniqueUserCount := result.Data.(int64)
|
||||
|
||||
if uniqueUserCount > int64(*license.Features.Users) {
|
||||
c.Err = model.NewAppError("addLicense", fmt.Sprintf("This license only supports %d users, when your system has %d unique users. Unique users are counted distinctly by email address. You can see total user count under Site Reports -> View Statistics.", *license.Features.Users, uniqueUserCount), "")
|
||||
c.Err = model.NewAppError("addLicense", api.license.add_license.unique_users.app_error, map[string]interface{}{"Users": *license.Features.Users, "Count": uniqueUserCount})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,7 +1157,7 @@ func uploadProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
path := "teams/" + c.Session.TeamId + "/users/" + c.Session.UserId + "/profile.png"
|
||||
|
||||
if err := writeFile(buf.Bytes(), path); err != nil {
|
||||
c.Err = model.NewAppError("uploadProfileImage", "Couldn't upload profile image", "")
|
||||
c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.upload_profile.app_error", nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
12
i18n/en.json
12
i18n/en.json
@@ -587,6 +587,14 @@
|
||||
"id": "api.license.add_license.open.app_error",
|
||||
"translation": "Could not open license file"
|
||||
},
|
||||
{
|
||||
"id": "api.license.add_license.invalid_count.app_error",
|
||||
"translation": "Unable to count total unique users."
|
||||
},
|
||||
{
|
||||
"id": "api.license.add_license.unique_users.app_error",
|
||||
"translation": "This license only supports {{.Users}} users, when your system has {{.Count}} unique users. Unique users are counted distinctly by email address. You can see total user count under Site Reports -> View Statistics."
|
||||
},
|
||||
{
|
||||
"id": "api.license.add_license.save.app_error",
|
||||
"translation": "License did not save properly."
|
||||
@@ -1543,6 +1551,10 @@
|
||||
"id": "api.user.upload_profile_user.encode.app_error",
|
||||
"translation": "Could not encode profile image"
|
||||
},
|
||||
{
|
||||
"id": "api.user.upload_profile_user.upload_profile.app_error",
|
||||
"translation": "Couldn't upload profile image"
|
||||
},
|
||||
{
|
||||
"id": "api.user.upload_profile_user.no_file.app_error",
|
||||
"translation": "No file under 'image' in request"
|
||||
|
||||
@@ -71,16 +71,6 @@ func AppErrorFromJson(data io.Reader) *AppError {
|
||||
}
|
||||
}
|
||||
|
||||
func NewAppError(where string, message string, details string) *AppError {
|
||||
ap := &AppError{}
|
||||
ap.Message = message
|
||||
ap.Where = where
|
||||
ap.DetailedError = details
|
||||
ap.StatusCode = 500
|
||||
ap.IsOAuth = false
|
||||
return ap
|
||||
}
|
||||
|
||||
func NewLocAppError(where string, id string, params map[string]interface{}, details string) *AppError {
|
||||
ap := &AppError{}
|
||||
ap.Id = id
|
||||
|
||||
Reference in New Issue
Block a user