[fixes issue 201]: added errors in output#203
Conversation
|
@Prathamesh0901 is attempting to deploy a commit to the Dhanush Nehru's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR enhances error handling in the code editor by displaying compilation and runtime errors from the Judge0 API in the output section instead of only showing a generic snackbar notification.
- Added a utility function to decode and format error messages from the Judge0 API
- Enhanced error handling to display stderr and compile_output errors in the output section
- Refactored stdout processing to use the new decoding utility function
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| fontWeight: "bold", | ||
| })); | ||
|
|
||
| const decodeFormat = (data) => { |
There was a problem hiding this comment.
The function name decodeFormat is ambiguous. Consider renaming it to decodeBase64Output or parseBase64Response to clearly indicate it decodes base64-encoded data and formats it as an array of lines.
| const decodeFormat = (data) => { | |
| const decodeBase64Output = (data) => { |
| setOutput(decodeFormat(data.stderr)); | ||
| } else if (data.compile_output) { | ||
| setOutput(decodeFormat(data.compile_output)); |
There was a problem hiding this comment.
[nitpick] Consider combining both error conditions to avoid duplication. You could use setOutput(decodeFormat(data.stderr || data.compile_output)) since both handle error scenarios similarly.
| setOutput(decodeFormat(data.stderr)); | |
| } else if (data.compile_output) { | |
| setOutput(decodeFormat(data.compile_output)); | |
| setOutput(decodeFormat(data.stderr || data.compile_output)); |
Resolves #[Issue Number if there]
PR Fixes:
Checklist before requesting a review
mainbranchnpm run lint:fixlocallyCurrently, there are no compilation or output errors shown in the editor. The only thing is a snackbar which is generic, the judge0 api provides compilation or any errors in the api, I have added them in the output section.
Current
Modified