Refactored the except CompilerError as e: in compuile_project a structured error response for failed tasks caused by CompilerError. This introduces a new Pydantic model to format the error and ensure it's compatible with frontend systems via FastAPI.
fixes: #50
How I did it
Added a CompilerErrorModel class using Pydantic, which includes fields like message, line, column, and errorType.
Updated the logic within the compile_project function to handle and format CompilerError in line with the new model.
How to verify it
Trigger a compilation task that raises a CompilerError by submitting a Vyper contract with a syntax error.
Check the response from /exceptions/{task_id} to verify that the error details are returned in the correct format, as described in the issue.
Ensure that the response structure matches the frontend expectations (JSON format with specific error fields).
Checklist
[] All changes are completed
[] New test cases have been added for error handling and proper formatting of CompilerError.
[ ] Documentation has been updated to reflect the changes in /exceptions/{task_id} endpoint behavior.
What still needs to check and verify
Refactored the /exceptions/{task_id} endpoint to check specifically for tasks that failed due to a CompilerError and return a structured JSON response for the error.
What I did
Refactored the
except CompilerError as e: in compuile_project
a structured error response for failed tasks caused byCompilerError
. This introduces a new Pydantic model to format the error and ensure it's compatible with frontend systems via FastAPI.fixes: #50
How I did it
CompilerErrorModel
class using Pydantic, which includes fields likemessage
,line
,column
, anderrorType
.compile_project
function to handle and formatCompilerError
in line with the new model.How to verify it
CompilerError
by submitting a Vyper contract with a syntax error./exceptions/{task_id}
to verify that the error details are returned in the correct format, as described in the issue.Checklist
CompilerError
./exceptions/{task_id}
endpoint behavior.What still needs to check and verify
/exceptions/{task_id}
endpoint to check specifically for tasks that failed due to aCompilerError
and return a structured JSON response for the error.