skybase 0.1.100 → 0.1.105

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/CHANGELOG.md CHANGED
@@ -1,24 +1,25 @@
1
- ## [0.1.99](https://github.com/kongnet/skybase/compare/v0.1.98...v0.1.99) (2025-10-15)
1
+ ## [0.1.104](https://github.com/kongnet/skybase/compare/v0.1.103...v0.1.104) (2025-12-13)
2
2
 
3
3
 
4
4
 
5
5
 
6
- ## [0.1.98](https://github.com/kongnet/skybase/compare/v0.1.97...v0.1.98) (2025-10-14)
6
+ ## [0.1.103](https://github.com/kongnet/skybase/compare/v0.1.102...v0.1.103) (2025-12-13)
7
7
 
8
8
 
9
9
 
10
10
 
11
- ## [0.1.97](https://github.com/kongnet/skybase/compare/v0.1.96...v0.1.97) (2025-10-14)
11
+ ## [0.1.102](https://github.com/kongnet/skybase/compare/v0.1.101...v0.1.102) (2025-12-13)
12
12
 
13
13
 
14
14
 
15
15
 
16
- ## [0.1.96](https://github.com/kongnet/skybase/compare/v0.1.95...v0.1.96) (2025-10-14)
16
+ ## [0.1.101](https://github.com/kongnet/skybase/compare/v0.1.95...v0.1.101) (2025-12-13)
17
17
 
18
18
 
19
19
  ### :sparkles:
20
20
 
21
21
  * (koa 版本升级) ([eb043e1](https://github.com/kongnet/skybase/commit/eb043e18851d6946c92de77940a8756dfe89b920))
22
+ * 增加多语言前端自定义错误 ([107bea2](https://github.com/kongnet/skybase/commit/107bea25a2c4edcf6d59b46508f1efadd5d0d70c))
22
23
 
23
24
 
24
25
 
@@ -140,7 +140,25 @@ module.exports = async (ctx, next) => {
140
140
  )
141
141
  apiCheckLog(apiPath, ctx.checkedData, method, params, ctx)
142
142
  if (ctx.checkedData.code >= 400) {
143
- return ctx.throwCode(400, ctx.checkedData.msg)
143
+ /*
144
+ !有errSimple 看是否配置了语言参数_lang=en 或者 默认default,或者直接返回errSimple.
145
+ !没有 errSimple 返回 ctx.checkedData.msg
146
+ ^ errSimple: {
147
+ ^ default: 'Parameter error, please check the input parameters',
148
+ ^ zh: '参数错误,请检查输入参数'
149
+ ^ },
150
+ !或者
151
+ ^ errSimple:'err msg'
152
+ */
153
+ return ctx.throwCode(
154
+ 400,
155
+ apiSetting.errSimple
156
+ ? apiSetting.errSimple[params['_lang'] ? params['_lang'] : 'default'] ||
157
+ (typeof apiSetting.errSimple === 'string'
158
+ ? apiSetting.errSimple
159
+ : ctx.checkedData.msg)
160
+ : ctx.checkedData.msg
161
+ )
144
162
  }
145
163
  await next()
146
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skybase",
3
- "version": "0.1.100",
3
+ "version": "0.1.105",
4
4
  "description": "sky框架",
5
5
  "main": "index.js",
6
6
  "directories": {