mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 21:20:07 +08:00
Improve error handling in NCoreInitShell session creation
Refactored session creation logic to add nested try-catch blocks. Now logs specific errors for both StartupSession and Session creation failures, and throws if session creation fails.
This commit is contained in:
parent
bf684d9166
commit
3c60997b1c
@ -344,13 +344,16 @@ export async function NCoreInitShell() {
|
||||
let session: NodeIQQNTWrapperSession;
|
||||
let startupSession: NodeIQQNTStartupSessionWrapper | null = null;
|
||||
try {
|
||||
//session = new wrapper.NodeIQQNTWrapperSession();
|
||||
startupSession = wrapper.NodeIQQNTStartupSessionWrapper.create();
|
||||
// data.start();
|
||||
session = wrapper.NodeIQQNTWrapperSession.getNTWrapperSession('nt_1');
|
||||
} catch (e: unknown) {
|
||||
try {
|
||||
session = wrapper.NodeIQQNTWrapperSession.create();
|
||||
console.log('Error creating session:', e);
|
||||
} catch (error) {
|
||||
logger.logError('创建 StartupSession 失败', e);
|
||||
logger.logError('创建 Session 失败', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const [dataPath, dataPathGlobal] = getDataPaths(wrapper);
|
||||
const systemPlatform = getPlatformType();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user