@nocobase/plugin-error-handler 2.0.0-alpha.8 → 2.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +3 -3
- package/dist/locale/de-DE.json +4 -4
- package/dist/locale/en-US.json +4 -4
- package/dist/locale/es-ES.json +4 -4
- package/dist/locale/fr-FR.json +4 -4
- package/dist/locale/hu-HU.json +6 -0
- package/dist/locale/id-ID.json +6 -0
- package/dist/locale/it-IT.json +4 -3
- package/dist/locale/ja-JP.json +5 -3
- package/dist/locale/ko-KR.json +4 -3
- package/dist/locale/nl-NL.json +4 -3
- package/dist/locale/pt-BR.json +4 -4
- package/dist/locale/ru-RU.json +6 -0
- package/dist/locale/tr-TR.json +6 -0
- package/dist/locale/uk-UA.json +6 -0
- package/dist/locale/vi-VN.json +6 -0
- package/dist/locale/zh-CN.json +4 -3
- package/dist/locale/zh-TW.json +6 -0
- package/dist/server/server.js +21 -0
- package/package.json +7 -2
package/dist/externalVersion.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.1",
|
|
12
12
|
"@formily/json-schema": "2.3.7",
|
|
13
|
-
"@nocobase/database": "2.
|
|
14
|
-
"@nocobase/server": "2.
|
|
13
|
+
"@nocobase/database": "2.1.0-alpha.1",
|
|
14
|
+
"@nocobase/server": "2.1.0-alpha.1",
|
|
15
15
|
"lodash": "4.17.21"
|
|
16
16
|
};
|
package/dist/locale/de-DE.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"unique violation": "{{field}} existiert bereits",
|
|
3
|
-
"notNull violation": "{{field}} darf nicht null sein",
|
|
4
2
|
"Validation error": "{{field}} Validierungsfehler",
|
|
5
|
-
"notNull Violation": "{{field}} darf nicht null sein"
|
|
6
|
-
}
|
|
3
|
+
"notNull Violation": "{{field}} darf nicht null sein",
|
|
4
|
+
"notNull violation": "{{field}} darf nicht null sein",
|
|
5
|
+
"unique violation": "{{field}} existiert bereits"
|
|
6
|
+
}
|
package/dist/locale/en-US.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"unique violation": "{{field}} already exists",
|
|
3
|
-
"notNull violation": "{{field}} cannot be null",
|
|
4
2
|
"Validation error": "{{field}} validation error",
|
|
5
|
-
"notNull Violation": "{{field}} cannot be null"
|
|
6
|
-
}
|
|
3
|
+
"notNull Violation": "{{field}} cannot be null",
|
|
4
|
+
"notNull violation": "{{field}} cannot be null",
|
|
5
|
+
"unique violation": "{{field}} already exists"
|
|
6
|
+
}
|
package/dist/locale/es-ES.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"unique violation": "{{field}} debe ser único",
|
|
3
|
-
"notNull violation": "notNull violación",
|
|
4
2
|
"Validation error": "{{field}} error de validación",
|
|
5
|
-
"notNull Violation": "{{field}} no puede ser null"
|
|
6
|
-
|
|
3
|
+
"notNull Violation": "{{field}} no puede ser null",
|
|
4
|
+
"notNull violation": "notNull violación",
|
|
5
|
+
"unique violation": "{{field}} debe ser único"
|
|
6
|
+
}
|
package/dist/locale/fr-FR.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"unique violation": "{{field}} doit être unique",
|
|
3
|
-
"notNull violation": "Violation de contrainte notNull",
|
|
4
2
|
"Validation error": "Erreur de validation de {{field}}",
|
|
5
|
-
"notNull Violation": "{{field}} ne peut pas être null"
|
|
6
|
-
|
|
3
|
+
"notNull Violation": "{{field}} ne peut pas être null",
|
|
4
|
+
"notNull violation": "Violation de contrainte notNull",
|
|
5
|
+
"unique violation": "{{field}} doit être unique"
|
|
6
|
+
}
|
package/dist/locale/it-IT.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"Validation error": "{{field}} errore di convalida",
|
|
3
|
+
"notNull Violation": "{{field}} cannot be null",
|
|
3
4
|
"notNull violation": "{{field}} non può essere vuoto",
|
|
4
|
-
"
|
|
5
|
-
}
|
|
5
|
+
"unique violation": "{{field}} già esiste"
|
|
6
|
+
}
|
package/dist/locale/ja-JP.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"notNull Violation": "{{field}} はNullにできません"
|
|
4
|
-
}
|
|
2
|
+
"Validation error": "{{field}} 検証エラー",
|
|
3
|
+
"notNull Violation": "{{field}} はNullにできません",
|
|
4
|
+
"notNull violation": "{{field}} を空にすることはできません",
|
|
5
|
+
"unique violation": "{{field}} は一意でなくてはなりません"
|
|
6
|
+
}
|
package/dist/locale/ko-KR.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"Validation error": "{{field}} 필드 규칙 유효성 검사에 실패했습니다.",
|
|
3
|
+
"notNull Violation": "{{field}}는 null일 수 없습니다.",
|
|
3
4
|
"notNull violation": "{{field}} 필드는 비어 있을 수 없습니다.",
|
|
4
|
-
"
|
|
5
|
-
}
|
|
5
|
+
"unique violation": "{{field}} 필드 값은 고유해야 합니다."
|
|
6
|
+
}
|
package/dist/locale/nl-NL.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"Validation error": "{{field}} validatiefout",
|
|
3
|
+
"notNull Violation": "{{field}} cannot be null",
|
|
4
|
+
"notNull violation": "{{field}} mag niet leeg zijn",
|
|
5
|
+
"unique violation": "{{field}} bestaat al"
|
|
5
6
|
}
|
package/dist/locale/pt-BR.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"unique violation": "{{field}} deve ser único",
|
|
3
|
-
"notNull violation": "violação de não nulo",
|
|
4
2
|
"Validation error": "erro de validação de {{field}}",
|
|
5
|
-
"notNull Violation": "{{field}} não pode ser nulo"
|
|
6
|
-
|
|
3
|
+
"notNull Violation": "{{field}} não pode ser nulo",
|
|
4
|
+
"notNull violation": "violação de não nulo",
|
|
5
|
+
"unique violation": "{{field}} deve ser único"
|
|
6
|
+
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"Validation error": "{{field}} 字段规则验证失败",
|
|
3
|
+
"notNull Violation": "{{field}} cannot be null",
|
|
3
4
|
"notNull violation": "{{field}} 字段不能为空",
|
|
4
|
-
"
|
|
5
|
-
}
|
|
5
|
+
"unique violation": "{{field}} 字段值已存在"
|
|
6
|
+
}
|
package/dist/server/server.js
CHANGED
|
@@ -88,6 +88,27 @@ class PluginErrorHandlerServer extends import_server.Plugin {
|
|
|
88
88
|
ctx.status = 400;
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
|
+
this.errorHandler.register(
|
|
92
|
+
(err) => {
|
|
93
|
+
const e = (err == null ? void 0 : err.original) || err;
|
|
94
|
+
if ((e == null ? void 0 : e.errno) === 1064) return true;
|
|
95
|
+
if ((e == null ? void 0 : e.code) === "42601") return true;
|
|
96
|
+
if ((e == null ? void 0 : e.code) === "SQLITE_ERROR" && /syntax error/i.test(e == null ? void 0 : e.message)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
},
|
|
101
|
+
(err, ctx) => {
|
|
102
|
+
ctx.body = {
|
|
103
|
+
errors: [
|
|
104
|
+
{
|
|
105
|
+
message: "Invalid SQL syntax"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
};
|
|
109
|
+
ctx.status = 500;
|
|
110
|
+
}
|
|
111
|
+
);
|
|
91
112
|
}
|
|
92
113
|
async load() {
|
|
93
114
|
this.app.use(this.errorHandler.middleware(), { after: "i18n", tag: "errorHandler", before: "cors" });
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-error-handler",
|
|
3
3
|
"displayName": "Error handler",
|
|
4
|
+
"displayName.ru-RU": "Обработчик ошибок",
|
|
4
5
|
"displayName.zh-CN": "错误处理器",
|
|
6
|
+
"description.ru-RU": "Обработка ошибок и исключений приложения.",
|
|
5
7
|
"description": "Handling application errors and exceptions.",
|
|
6
8
|
"description.zh-CN": "处理应用程序中的错误和异常。",
|
|
7
|
-
"version": "2.
|
|
9
|
+
"version": "2.1.0-alpha.1",
|
|
8
10
|
"license": "AGPL-3.0",
|
|
9
11
|
"main": "./dist/server/index.js",
|
|
12
|
+
"homepage": "https://docs.nocobase.com/handbook/error-handler",
|
|
13
|
+
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/error-handler",
|
|
14
|
+
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/error-handler",
|
|
10
15
|
"devDependencies": {
|
|
11
16
|
"@formily/json-schema": "2.x",
|
|
12
17
|
"supertest": "^6.1.6"
|
|
@@ -23,5 +28,5 @@
|
|
|
23
28
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
24
29
|
"directory": "packages/plugin-error-handler"
|
|
25
30
|
},
|
|
26
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "d27baf21569643d6fa83f882233f4e90eb5b89f1"
|
|
27
32
|
}
|