Fix: Restore API execution routes and implement granular error handling (#229)#245
Open
Yash-Marathe91 wants to merge 3 commits into
Open
Fix: Restore API execution routes and implement granular error handling (#229)#245Yash-Marathe91 wants to merge 3 commits into
Yash-Marathe91 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes issue #229
What was the problem? The application was suffering from a critical SyntaxError (unmatched parenthesis) caused by an accidentally deleted run_script execution block in app.py. Additionally, the previous execution handlers only returned generic string messages ("error occurred") instead of providing developers with specific failure contexts or suggestions, making debugging severely difficult.
How did we fix it?
Restored the missing run_script() method and cleaned up syntax errors in app.py.
Expanded _classify_failure to utilize the new analyze_script_output_error utility, matching specific shell output logic to precise diagnostic constants (e.g., ERR_SCRIPT_SYNTAX, ERR_SCRIPT_PERMISSION).
Refactored the exception-handling blocks inside the SSE stream generators (run_script and exec_command) to utilize format_exception_details(e).
The backend now actively streams structured error_details (including context variables and remediation suggestions) so the frontend can properly consume and display actionable feedback.
Impact:
Fixes backend server crashes and restores the ability to execute scripts remotely.
Categorizes runtime errors seamlessly and prevents users from having to inspect server-side source code logs for basic troubleshooting.
Closes the loop on the structured error-handling refactor, providing a smooth, reliable development experience!
extract.py
replace.py
replace2.py
extract2.py
replace3.py