diff options
Diffstat (limited to 'app/license.go')
-rw-r--r-- | app/license.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/license.go b/app/license.go index 44b700d5b..8cb76fd6e 100644 --- a/app/license.go +++ b/app/license.go @@ -4,6 +4,7 @@ package app import ( + "net/http" "strings" l4g "github.com/alecthomas/log4go" @@ -49,17 +50,17 @@ func SaveLicense(licenseBytes []byte) (*model.License, *model.AppError) { license = model.LicenseFromJson(strings.NewReader(licenseStr)) if result := <-Srv.Store.User().AnalyticsUniqueUserCount(""); result.Err != nil { - return nil, model.NewLocAppError("addLicense", "api.license.add_license.invalid_count.app_error", nil, result.Err.Error()) + return nil, model.NewAppError("addLicense", "api.license.add_license.invalid_count.app_error", nil, result.Err.Error(), http.StatusBadRequest) } else { uniqueUserCount := result.Data.(int64) if uniqueUserCount > int64(*license.Features.Users) { - return nil, model.NewLocAppError("addLicense", "api.license.add_license.unique_users.app_error", map[string]interface{}{"Users": *license.Features.Users, "Count": uniqueUserCount}, "") + return nil, model.NewAppError("addLicense", "api.license.add_license.unique_users.app_error", map[string]interface{}{"Users": *license.Features.Users, "Count": uniqueUserCount}, "", http.StatusBadRequest) } } if ok := utils.SetLicense(license); !ok { - return nil, model.NewLocAppError("addLicense", model.EXPIRED_LICENSE_ERROR, nil, "") + return nil, model.NewAppError("addLicense", model.EXPIRED_LICENSE_ERROR, nil, "", http.StatusBadRequest) } record := &model.LicenseRecord{} @@ -69,7 +70,7 @@ func SaveLicense(licenseBytes []byte) (*model.License, *model.AppError) { if result := <-rchan; result.Err != nil { RemoveLicense() - return nil, model.NewLocAppError("addLicense", "api.license.add_license.save.app_error", nil, "err="+result.Err.Error()) + return nil, model.NewAppError("addLicense", "api.license.add_license.save.app_error", nil, "err="+result.Err.Error(), http.StatusInternalServerError) } sysVar := &model.System{} @@ -79,10 +80,10 @@ func SaveLicense(licenseBytes []byte) (*model.License, *model.AppError) { if result := <-schan; result.Err != nil { RemoveLicense() - return nil, model.NewLocAppError("addLicense", "api.license.add_license.save_active.app_error", nil, "") + return nil, model.NewAppError("addLicense", "api.license.add_license.save_active.app_error", nil, "", http.StatusInternalServerError) } } else { - return nil, model.NewLocAppError("addLicense", model.INVALID_LICENSE_ERROR, nil, "") + return nil, model.NewAppError("addLicense", model.INVALID_LICENSE_ERROR, nil, "", http.StatusBadRequest) } ReloadConfig() |