-
Notifications
You must be signed in to change notification settings - Fork 664
Handle errors during progress updates #1429
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
Add try-catch block around onProgress call to handle potential errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds error handling around a progress callback invocation to prevent potential errors from breaking the translation flow. While this is a step in the right direction, the implementation has some issues that should be addressed.
Key Changes
- Wrapped the final
onProgress(100, {}, result)call in a try-catch block to handle potential errors - Added error handling specifically at the completion stage of translation processing
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| try { | ||
| onProgress(100, {}, result); | ||
| } catch {} |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty catch block silently swallows any errors from onProgress, making debugging difficult. Consider at least logging the error:
try {
onProgress(100, {}, result);
} catch (error) {
console.error('Error during progress update:', error);
}This will help identify issues while still preventing the error from breaking the translation flow.
| } catch {} | |
| } catch (error) { | |
| console.error('Error during progress update:', error); | |
| } |
| try { | ||
| onProgress(100, {}, result); | ||
| } catch {} |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error handling is inconsistent - the onProgress call at line 25 (inside the loop) doesn't have error handling, but this final call at line 31 does. Consider applying the same error handling pattern to both locations for consistency. If errors in progress callbacks could occur during chunk processing, they should also be handled there.
|
@theabhishekbhujang please resolve comments |
Add try-catch block around onProgress call to handle potential errors.