Skip to content

Fix: Restore API execution routes and implement granular error handling (#229)#245

Open
Yash-Marathe91 wants to merge 3 commits into
siddu-k:mainfrom
Yash-Marathe91:fix-error-handling
Open

Fix: Restore API execution routes and implement granular error handling (#229)#245
Yash-Marathe91 wants to merge 3 commits into
siddu-k:mainfrom
Yash-Marathe91:fix-error-handling

Conversation

@Yash-Marathe91

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant