-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Silent fail on impossible file write #553
Comments
Hey, I will like to work on it. Can you please tell the file name in which I have to make changes. |
@rsh-raj thanks for considering this! Writing the solution (or any other error message) happens in the vroom/src/utils/output_json.cpp Lines 347 to 356 in 7be0b4f
But throwing an exception there would not be of much help. Indeed, we have a number of Lines 177 to 196 in 7be0b4f
So I think our best bet would be to check for a valid output file right after all flags are parsed. I'm not very familiar with output streams and file handling but it looks like |
@jcoupey
The method I would suggest is to create a validation function to vroom::io that validate permission and existence, then check right after the arguments are parsed. If invalid to write an output then fallback to the standard output. (1-a, 2-c, 3) |
@erdemuysal thanks for stepping up on this one too!
I agree a) would be better here since we'd then avoid performing routing requests and solving the problem for nothing.
Deciding to create a non-existing directory on behalf of the user running
As you suggest, catching a permission problem should probably be part of the check from point 1.
I'd keep this summary except I'd simply exit without doing anything in case writing to the requested file is impossible. You can have your vroom::io validation function throw a |
Moving this to the next milestone again. Maybe that would be a good opportunity to switch to using the |
Additionally, we could provide a better feedback for a missing input file. The current (cryptic) error is:
|
Suppose we have an
input.json
file in the current directory andfoo
is not a valid directory. Thenfails to write any output. The return code is
0
, which is somehow consistent with exiting silently.We should really raise an error when writing to a file is requested and turns out to be impossible.
The text was updated successfully, but these errors were encountered: