forked from nocobase/nocobase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(data-source-main): field name exists error message (nocobase#4689)
* chore: test * chore: throw field name exists error * chore: error message * chore: error locale * fix: i18n message
- Loading branch information
Showing
8 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/plugins/@nocobase/plugin-data-source-main/src/locale/en-US.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"field-name-exists": "Field name \"{{name}}\" already exists in collection \"{{collectionName}}\"" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/plugins/@nocobase/plugin-data-source-main/src/locale/zh-CN.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"field-name-exists": "字段标识 \"{{name}}\" 已存在" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...es/plugins/@nocobase/plugin-data-source-main/src/server/errors/field-name-exists-error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* This file is part of the NocoBase (R) project. | ||
* Copyright (c) 2020-2024 NocoBase Co., Ltd. | ||
* Authors: NocoBase Team. | ||
* | ||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. | ||
* For more information, please refer to: https://www.nocobase.com/agreement. | ||
*/ | ||
|
||
export class FieldNameExistsError extends Error { | ||
value: string; | ||
collectionName: string; | ||
|
||
constructor(value: string, collectionName: string) { | ||
super(`Field name "${value}" already exists in collection "${collectionName}"`); | ||
this.value = value; | ||
this.collectionName = collectionName; | ||
|
||
this.name = 'FieldNameExistsError'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters