-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: handle AbortError gracefully when loading commands #936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📋 Review SummaryThis PR addresses an issue where 🔍 General Feedback
🎯 Specific Feedback🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
TLDR
Fix
FileCommandLoaderto silently ignoreAbortErrorwhen command loading operations are cancelled viaAbortSignal. Previously, cancelled operations would incorrectly log error messages to the console.Dive Deeper
When loading custom commands, the
glob()function receives anAbortSignalto support cancellation. If the operation is cancelled (e.g., when a React component unmounts inuseSlashCommandProcessor),glob()throws aDOMException [AbortError].The current error handler only checks for
ENOENT(directory doesn't exist) but doesn't handleAbortError, which is expected behavior when operations are cancelled. This causes error messages to be logged even though cancellation is a normal, expected operation.The fix adds a check for
AbortErrorin the catch block alongside the existingENOENTcheck, ensuring that cancelled operations are silently ignored instead of being logged as errors.Testing Matrix
Linked issues / bugs
Fixes #928