This commit is contained in:
COOL 2025-02-08 20:14:48 +08:00
parent 33ece89a50
commit 3c4f38be74
2 changed files with 7 additions and 2 deletions

View File

@ -53,7 +53,7 @@
}, },
"scripts": { "scripts": {
"start": "NODE_ENV=production node ./bootstrap.js", "start": "NODE_ENV=production node ./bootstrap.js",
"dev": "rimraf src/index.ts && cross-env NODE_ENV=local mwtsc --cleanOutDir --watch --run @midwayjs/mock/app.js", "dev": "rimraf src/index.ts && cool check && cross-env NODE_ENV=local mwtsc --cleanOutDir --watch --run @midwayjs/mock/app.js",
"test": "cross-env NODE_ENV=unittest jest", "test": "cross-env NODE_ENV=unittest jest",
"cov": "jest --coverage", "cov": "jest --coverage",
"lint": "mwts check", "lint": "mwts check",

View File

@ -38,7 +38,7 @@ export class BaseTranslateMiddleware
this.logger.error(error); this.logger.error(error);
// 处理翻译消息 // 处理翻译消息
if (error.name == 'CoolCommException') { if (error.name == 'CoolCommException') {
if (language && error.message && error.message !== 'success') { if (error.message && error.message !== 'success') {
ctx.status = error.statusCode || 200; ctx.status = error.statusCode || 200;
ctx.body = { ctx.body = {
code: RESCODE.COMMFAIL, code: RESCODE.COMMFAIL,
@ -51,6 +51,11 @@ export class BaseTranslateMiddleware
return; return;
} }
} }
ctx.status = 500;
ctx.body = {
code: RESCODE.COMMFAIL,
message: 'Service Error',
};
return; return;
} }
if (!this.config.enable) { if (!this.config.enable) {