You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2024/05/13 06:00:38 UTC

(incubator-devlake) branch update-scope-config-error updated: fix: optimize error messages when there are duplicate scope configurations.

This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch update-scope-config-error
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/update-scope-config-error by this push:
     new b4a584eff fix: optimize error messages when there are duplicate scope configurations.
b4a584eff is described below

commit b4a584eff24e06d0fca88012c94ed034a7e7048a
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon May 13 14:00:24 2024 +0800

    fix: optimize error messages when there are duplicate scope configurations.
---
 backend/helpers/srvhelper/model_service_helper.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/helpers/srvhelper/model_service_helper.go b/backend/helpers/srvhelper/model_service_helper.go
index 3ec9abe39..70acbe446 100644
--- a/backend/helpers/srvhelper/model_service_helper.go
+++ b/backend/helpers/srvhelper/model_service_helper.go
@@ -103,7 +103,7 @@ func (srv *ModelSrvHelper[M]) Create(model *M) errors.Error {
 	err = srv.db.Create(model)
 	if err != nil {
 		if srv.db.IsDuplicationError(err) {
-			return errors.Conflict.Wrap(err, fmt.Sprintf("%s already exists", srv.modelName))
+			return errors.Default.New("The name of the current scope config is duplicated. Please modify it before saving.")
 		}
 		return err
 	}