mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: error stack
This commit is contained in:
parent
666da80ef5
commit
2e108a4bd6
@ -242,7 +242,7 @@ export async function uri2local(dir: string, uri: string, filename: string | und
|
||||
//解析Http和Https协议
|
||||
|
||||
if (UriType == FileUriType.Unknown) {
|
||||
return { success: false, errMsg: '未知文件类型', fileName: '', ext: '', path: '' };
|
||||
return { success: false, errMsg: `未知文件类型, uri= ${uri}`, fileName: '', ext: '', path: '' };
|
||||
}
|
||||
//解析File协议和本地文件
|
||||
if (UriType == FileUriType.Local) {
|
||||
@ -289,5 +289,5 @@ export async function uri2local(dir: string, uri: string, filename: string | und
|
||||
}
|
||||
return { success: true, errMsg: '', fileName: filename, ext: fileExt, path: filePath };
|
||||
}
|
||||
return { success: false, errMsg: '未知文件类型', fileName: '', ext: '', path: '' };
|
||||
return { success: false, errMsg: `未知文件类型, uri= ${uri}`, fileName: '', ext: '', path: '' };
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ abstract class BaseAction<PayloadType, ReturnDataType> {
|
||||
return OB11Response.ok(resData);
|
||||
} catch (e: any) {
|
||||
this.core.context.logger.logError.bind(this.core.context.logger)('发生错误', e);
|
||||
return OB11Response.error(e?.toString() || e?.stack?.toString() || '未知错误,可能操作超时', 200);
|
||||
return OB11Response.error(e?.stack?.toString() || e?.toString() || '未知错误,可能操作超时', 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,8 +122,8 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
returnMsgAndResId = packetMode
|
||||
? await this.handleForwardedNodesPacket(peer, messages as OB11MessageNode[], payload.source, payload.news, payload.summary, payload.prompt)
|
||||
: await this.handleForwardedNodes(peer, messages as OB11MessageNode[]);
|
||||
} catch (e) {
|
||||
throw Error(packetMode ? `发送伪造合并转发消息失败: ${e}` : `发送合并转发消息失败: ${e}`);
|
||||
} catch (e: any) {
|
||||
throw Error(packetMode ? `发送伪造合并转发消息失败: ${e?.stack}` : `发送合并转发消息失败: ${e?.stack}`);
|
||||
}
|
||||
if (!returnMsgAndResId) {
|
||||
throw Error('发送合并转发消息失败:returnMsgAndResId 为空!');
|
||||
@ -308,8 +308,8 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
MessageUnique.createUniqueMsgId(selfPeer, result.value.msgId);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
logger.logDebug('生成转发消息节点失败', e);
|
||||
} catch (e: any) {
|
||||
logger.logDebug('生成转发消息节点失败', e?.stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -350,8 +350,8 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
return {
|
||||
message: await this.core.apis.MsgApi.multiForwardMsg(srcPeer!, destPeer, retMsgIds)
|
||||
};
|
||||
} catch (e) {
|
||||
logger.logError.bind(this.core.context.logger)('forward failed', e);
|
||||
} catch (e: any) {
|
||||
logger.logError.bind(this.core.context.logger)('forward failed', e?.stack);
|
||||
return {
|
||||
message: null
|
||||
};
|
||||
@ -376,8 +376,8 @@ export class SendMsg extends BaseAction<OB11PostSendMsg, ReturnDataType> {
|
||||
}
|
||||
try {
|
||||
return await this.core.apis.MsgApi.sendMsg(selfPeer, sendElements, true);
|
||||
} catch (e) {
|
||||
logger.logError.bind(this.core.context.logger)(e, '克隆转发消息失败,将忽略本条消息', msg);
|
||||
} catch (e: any) {
|
||||
logger.logError.bind(this.core.context.logger)(e?.stack, '克隆转发消息失败,将忽略本条消息', msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user