forked from mirror/MCSM-Daemon
完善 重启输出报错&细节问题
This commit is contained in:
parent
ce254b2a21
commit
72fcf0819d
@ -51,7 +51,7 @@ export default class GeneralRestartCommand extends InstanceCommand {
|
||||
} catch (error) {
|
||||
clearInterval(task);
|
||||
instance.setLock(false);
|
||||
throw error;
|
||||
instance.failure(error);
|
||||
}
|
||||
}, 1000);
|
||||
} catch (error) {
|
||||
|
@ -293,6 +293,7 @@ export default class Instance extends EventEmitter {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 执行预设命令动作
|
||||
async execPreset(action: string, p?: any) {
|
||||
if (this.presetCommandManager) {
|
||||
return await this.presetCommandManager.execPreset(action, p);
|
||||
|
@ -36,7 +36,7 @@ routerApp.use(async (event, ctx, data, next) => {
|
||||
if (ctx.session.stream && ctx.session.stream.check === true && ctx.session.type === "STREAM") {
|
||||
return await next();
|
||||
}
|
||||
return protocol.error(ctx, "error", "权限不足,非法访问");
|
||||
return protocol.error(ctx, "error", "[Unauthorized Access] 权限不足,非法访问");
|
||||
}
|
||||
return await next();
|
||||
});
|
||||
|
@ -53,7 +53,9 @@ export function responseError(ctx: RouterContext, err: Error | string) {
|
||||
if (err) errinfo = err.toString();
|
||||
else errinfo = err;
|
||||
const packet = new Packet(ctx.uuid, STATUS_ERR, ctx.event, errinfo);
|
||||
logger.error(`会话 ${ctx.socket.id}(${ctx.socket.handshake.address})/${ctx.event} 响应数据时异常:\n`, err);
|
||||
// 忽略因为重启守护进程没有刷新网页的权限不足错误
|
||||
if (err.toString().includes("[Unauthorized Access]")) return ctx.socket.emit(ctx.event, packet);
|
||||
logger.warn(`会话 ${ctx.socket.id}(${ctx.socket.handshake.address})/${ctx.event} 响应数据时异常:\n`, err);
|
||||
ctx.socket.emit(ctx.event, packet);
|
||||
}
|
||||
|
||||
@ -64,7 +66,9 @@ export function msg(ctx: RouterContext, event: string, data: any) {
|
||||
|
||||
export function error(ctx: RouterContext, event: string, err: any) {
|
||||
const packet = new Packet(ctx.uuid, STATUS_ERR, event, err);
|
||||
logger.error(`会话 ${ctx.socket.id}(${ctx.socket.handshake.address})/${event} 响应数据时异常:\n`, err);
|
||||
// 忽略因为重启守护进程没有刷新网页的权限不足错误
|
||||
if (err.toString().includes("[Unauthorized Access]")) return ctx.socket.emit(ctx.event, packet);
|
||||
logger.warn(`会话 ${ctx.socket.id}(${ctx.socket.handshake.address})/${event} 响应数据时异常:\n`, err);
|
||||
ctx.socket.emit(event, packet);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user