Merge branch 'release'
This commit is contained in:
commit
5857cefd7d
|
|
@ -39,7 +39,13 @@ function concat(...paths) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
||||||
const errorHandler = require((0, path_1.join)(path, 'lib', 'configuration', 'errors')).default;
|
let errorHandler = undefined;
|
||||||
|
try {
|
||||||
|
errorHandler = require((0, path_1.join)(path, 'lib', 'configuration', 'errors')).default;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// 不存在errors配置
|
||||||
|
}
|
||||||
const serverConfiguration = require((0, path_1.join)(path, 'lib', 'configuration', 'server')).default;
|
const serverConfiguration = require((0, path_1.join)(path, 'lib', 'configuration', 'server')).default;
|
||||||
// 拿到package.json,用作项目的唯一标识,否则无法区分不同项目的Redis+socketIO连接
|
// 拿到package.json,用作项目的唯一标识,否则无法区分不同项目的Redis+socketIO连接
|
||||||
const packageJson = require((0, path_1.join)(path, 'package.json'));
|
const packageJson = require((0, path_1.join)(path, 'package.json'));
|
||||||
|
|
@ -171,6 +177,8 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) {
|
||||||
if (props.level === "error") {
|
if (props.level === "error") {
|
||||||
appLoader.execRoutine(async (ctx) => {
|
appLoader.execRoutine(async (ctx) => {
|
||||||
await errorHandler(props.caller, props.args, ctx);
|
await errorHandler(props.caller, props.args, ctx);
|
||||||
|
}).catch((err) => {
|
||||||
|
console.warn('执行全局错误处理失败:', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return props.args;
|
return props.args;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@xuchangzju/oak-cli",
|
"name": "@xuchangzju/oak-cli",
|
||||||
"version": "4.0.27",
|
"version": "4.0.28",
|
||||||
"description": "client for oak framework",
|
"description": "client for oak framework",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mini-css-extract-plugin": "^2.5.3",
|
"mini-css-extract-plugin": "^2.5.3",
|
||||||
"node-watch": "^0.7.4",
|
"node-watch": "^0.7.4",
|
||||||
"oak-backend-base": "^4.1.22",
|
"oak-backend-base": "^4.1.23",
|
||||||
"oak-domain": "^5.1.28",
|
"oak-domain": "^5.1.28",
|
||||||
"oak-frontend-base": "^5.3.38",
|
"oak-frontend-base": "^5.3.38",
|
||||||
"parse-asn1": "5.1.6",
|
"parse-asn1": "5.1.6",
|
||||||
|
|
|
||||||
|
|
@ -57,12 +57,18 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
||||||
routine?: (context: AsyncContext<ED>) => Promise<void>,
|
routine?: (context: AsyncContext<ED>) => Promise<void>,
|
||||||
): Promise<(() => Promise<any>) | any> {
|
): Promise<(() => Promise<any>) | any> {
|
||||||
|
|
||||||
const errorHandler: ErrorHandler<ED> = require(join(
|
let errorHandler: ErrorHandler<ED> | undefined = undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
errorHandler = require(join(
|
||||||
path,
|
path,
|
||||||
'lib',
|
'lib',
|
||||||
'configuration',
|
'configuration',
|
||||||
'errors'
|
'errors'
|
||||||
)).default;
|
)).default;
|
||||||
|
} catch (err) {
|
||||||
|
// 不存在errors配置
|
||||||
|
}
|
||||||
|
|
||||||
const serverConfiguration: ServerConfiguration = require(join(
|
const serverConfiguration: ServerConfiguration = require(join(
|
||||||
path,
|
path,
|
||||||
|
|
@ -218,7 +224,9 @@ export async function startup<ED extends EntityDict & BaseEntityDict, FrontCxt e
|
||||||
polyfillConsole("startup", true, (props) => {
|
polyfillConsole("startup", true, (props) => {
|
||||||
if (props.level === "error") {
|
if (props.level === "error") {
|
||||||
appLoader.execRoutine(async (ctx) => {
|
appLoader.execRoutine(async (ctx) => {
|
||||||
await errorHandler( props.caller, props.args, ctx);
|
await errorHandler(props.caller, props.args, ctx);
|
||||||
|
}).catch((err) => {
|
||||||
|
console.warn('执行全局错误处理失败:', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return props.args;
|
return props.args;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import { LogFormatter, LogFormatterProp, polyfillConsole } from "./polyfill";
|
||||||
服务器重启 → 清理缓存并重新启动服务
|
服务器重启 → 清理缓存并重新启动服务
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare const require: NodeRequire;
|
declare const require: NodeJS.Require;
|
||||||
declare const process: NodeJS.Process;
|
declare const process: NodeJS.Process;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue