Improve error messages for QLAPI initialization

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-11-22 14:34:17 +00:00
parent 16b20e8b54
commit eab8a93f28
2 changed files with 14 additions and 4 deletions

View File

@ -27,9 +27,15 @@ if (typeof QLAPI === 'undefined') {
};
} catch (error) {
console.error(
'Failed to initialize QLAPI. Please run this script using the "task" command or add it as a scheduled task.',
'\n❌ Failed to initialize QLAPI. This usually happens because:',
);
console.error('Example: task ql_sample.js');
console.error(' 1. The Qinglong backend is not running');
console.error(' 2. Required files are not yet generated\n');
console.error(
'Solution: Use the "task" command instead of running directly:',
);
console.error(' Example: task ql_sample.js');
console.error(' Or add this script as a scheduled task in the panel\n');
console.error('Error details:', error.message);
process.exit(1);
}

View File

@ -29,8 +29,12 @@ except NameError:
QLAPI = BaseApi()
except Exception as error:
print('Failed to initialize QLAPI. Please run this script using the "task" command or add it as a scheduled task.')
print('Example: task ql_sample.py')
print('\n❌ Failed to initialize QLAPI. This usually happens because:')
print(' 1. The Qinglong backend is not running')
print(' 2. Required files are not yet generated\n')
print('Solution: Use the "task" command instead of running directly:')
print(' Example: task ql_sample.py')
print(' Or add this script as a scheduled task in the panel\n')
print(f'Error details: {error}')
sys.exit(1)