@nocobase/plugin-error-handler 2.0.0-alpha.9 → 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.
@@ -8,9 +8,9 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.0.0-alpha.9",
11
+ "@nocobase/client": "2.1.0-alpha.1",
12
12
  "@formily/json-schema": "2.3.7",
13
- "@nocobase/database": "2.0.0-alpha.9",
14
- "@nocobase/server": "2.0.0-alpha.9",
13
+ "@nocobase/database": "2.1.0-alpha.1",
14
+ "@nocobase/server": "2.1.0-alpha.1",
15
15
  "lodash": "4.17.21"
16
16
  };
@@ -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
+ }
@@ -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
+ }
@@ -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
+ }
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "{{field}} érvényességi hiba",
3
+ "notNull Violation": "{{field}} nem lehet null",
4
+ "notNull violation": "{{field}} nem lehet null",
5
+ "unique violation": "{{field}} már létezik"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "Kesalahan validasi {{field}}",
3
+ "notNull Violation": "{{field}} tidak boleh kosong",
4
+ "notNull violation": "{{field}} tidak boleh kosong",
5
+ "unique violation": "{{field}} sudah ada"
6
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
- "unique violation": "{{field}} già esiste",
2
+ "Validation error": "{{field}} errore di convalida",
3
+ "notNull Violation": "{{field}} cannot be null",
3
4
  "notNull violation": "{{field}} non può essere vuoto",
4
- "Validation error": "{{field}} errore di convalida"
5
- }
5
+ "unique violation": "{{field}} già esiste"
6
+ }
@@ -1,4 +1,6 @@
1
1
  {
2
- "unique violation": "{{field}} は一意でなくてはなりません",
3
- "notNull Violation": "{{field}} はNullにできません"
4
- }
2
+ "Validation error": "{{field}} 検証エラー",
3
+ "notNull Violation": "{{field}} はNullにできません",
4
+ "notNull violation": "{{field}} を空にすることはできません",
5
+ "unique violation": "{{field}} は一意でなくてはなりません"
6
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
- "unique violation": "{{field}} 필드 값은 고유해야 합니다.",
2
+ "Validation error": "{{field}} 필드 규칙 유효성 검사에 실패했습니다.",
3
+ "notNull Violation": "{{field}}는 null일 수 없습니다.",
3
4
  "notNull violation": "{{field}} 필드는 비어 있을 수 없습니다.",
4
- "Validation error": "{{field}} 필드 규칙 유효성 검사에 실패했습니다."
5
- }
5
+ "unique violation": "{{field}} 필드 값은 고유해야 합니다."
6
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
- "unique violation": "{{field}} bestaat al",
3
- "notNull violation": "{{field}} mag niet leeg zijn",
4
- "Validation error": "{{field}} validatiefout"
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
  }
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "Ошибка валидации поля {{field}}",
3
+ "notNull Violation": "{{field}} не может быть пустым",
4
+ "notNull violation": "{{field}} не может быть пустым",
5
+ "unique violation": "{{field}} уже существует"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "{{field}} validation error",
3
+ "notNull Violation": "{{field}} cannot be null",
4
+ "notNull violation": "{{field}} cannot be null",
5
+ "unique violation": "{{field}} already exists"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "{{field}} validation error",
3
+ "notNull Violation": "{{field}} cannot be null",
4
+ "notNull violation": "{{field}} cannot be null",
5
+ "unique violation": "{{field}} already exists"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "{{field}} validation error",
3
+ "notNull Violation": "{{field}} cannot be null",
4
+ "notNull violation": "{{field}} cannot be null",
5
+ "unique violation": "{{field}} already exists"
6
+ }
@@ -1,5 +1,6 @@
1
1
  {
2
- "unique violation": "{{field}} 字段值已存在",
2
+ "Validation error": "{{field}} 字段规则验证失败",
3
+ "notNull Violation": "{{field}} cannot be null",
3
4
  "notNull violation": "{{field}} 字段不能为空",
4
- "Validation error": "{{field}} 字段规则验证失败"
5
- }
5
+ "unique violation": "{{field}} 字段值已存在"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "Validation error": "{{field}} validation error",
3
+ "notNull Violation": "{{field}} cannot be null",
4
+ "notNull violation": "{{field}} cannot be null",
5
+ "unique violation": "{{field}} already exists"
6
+ }
@@ -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.0.0-alpha.9",
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": "4a9acf96f21a3aa35bccbd188b942595b09da0a9"
31
+ "gitHead": "d27baf21569643d6fa83f882233f4e90eb5b89f1"
27
32
  }