From eab8a93f287eb9ec20843bf5b1e4c97a0bda23f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 14:34:17 +0000 Subject: [PATCH] Improve error messages for QLAPI initialization Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- sample/ql_sample.js | 10 ++++++++-- sample/ql_sample.py | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sample/ql_sample.js b/sample/ql_sample.js index 64053198..9a2bf317 100644 --- a/sample/ql_sample.js +++ b/sample/ql_sample.js @@ -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); } diff --git a/sample/ql_sample.py b/sample/ql_sample.py index af7fb87a..d183523d 100644 --- a/sample/ql_sample.py +++ b/sample/ql_sample.py @@ -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)