Uh oh!
There was an error while loading. Please reload this page.
issue:2481 - Unhandled Exception on non-existent file - #2642
issue:2481 - Unhandled Exception on non-existent file#2642juliazhorniakAMI wants to merge 1 commit into
Conversation
kmr-srbh
commented
Apr 5, 2024
Hello @juliazhorniakAMI! Welcome to LPython. We already have a mechanism for detecting non-existent input files and catching errors at runtime. Could you please be more specific regarding what the PR changes? I feel this might be redundant. |
ubaidsk
commented
Apr 8, 2024
@juliazhorniakAMI Thanks for this. Could you share which specific error/issue this change fixes? Sharing an example |
| } | ||
| catch (const std::exception& e) { | ||
| std::cerr << "Error: " << e.what() << std::endl; | ||
| return 1; |
There was a problem hiding this comment.
@juliazhorniakAMI The change seems fine to me. Although I would like to see a test case that was failing before.
ubaidsk
commented
Apr 11, 2024
Thanks for working on this @juliazhorniakAMI! I shared a query above. I am marking this as draft for now. Please mark "Ready for review" when ready. |
kmr-srbh
commented
Apr 11, 2024
@Shaikh-Ubaid , this PR was meant to be a fix for #2481, but that was fixed by #2536. The issue is open till now though. |
This modification will print a specific error message ("Error: The input file does not exist") and exit with a return code of 1 if the input file doesn't exist. It catches any other exceptions thrown during the execution and prints their error message as well. Make sure to replace "your existing code here" with the relevant parts of your program.