get_target_file currently throws an exception if you request a file that doesn't exist. This is counterintuitive based on the doc comment with @return [File|nil]. This logic should instead return nil if the file doesn't exist, rather than throwing an exception.
Example below. Note that the_file_dne.inspect prints nil only because that value wasn't set because it fell into the rescue block. If you did this in python, you'd get: NameError: name 'the_file_dne' is not defined
Rationale: checking if the returned value is nil is cleaner/easier in the script in case you ask for a file that doesn't exist. Let exceptions be for other catastrophic errors.
Make sure to also update python implementation, and update docs (which currently don't say anything about nil here)
This is an API breaking change, so should be in the 7.0 release
get_target_file currently throws an exception if you request a file that doesn't exist. This is counterintuitive based on the doc comment with
@return [File|nil]. This logic should instead return nil if the file doesn't exist, rather than throwing an exception.Example below. Note that
the_file_dne.inspectprintsnilonly because that value wasn't set because it fell into therescueblock. If you did this in python, you'd get:NameError: name 'the_file_dne' is not definedRationale: checking if the returned value is nil is cleaner/easier in the script in case you ask for a file that doesn't exist. Let exceptions be for other catastrophic errors.
Make sure to also update python implementation, and update docs (which currently don't say anything about nil here)
This is an API breaking change, so should be in the 7.0 release