rawtoaces icon indicating copy to clipboard operation
rawtoaces copied to clipboard

fix: prefer std::filesystem error_code overloads over exceptions

Open hesam-oxe opened this issue 5 months ago • 2 comments

Replaced throwing std::filesystem calls with non-throwing error_code overloads in process_image() and make_output_path().

Changes

  • process_image(): Removed try/catch around std::filesystem::exists(), now uses std::filesystem::exists(path, ec) with explicit error_code handling
  • make_output_path(): Updated exists() and create_directory() calls to use error_code overloads
  • Preserves existing Status::FilesystemError and Status::InputFileNotFound behavior

Why

The C++ standard library allows querying filesystem operations with error_code instead of exceptions. This avoids exception-based control flow for expected filesystem failures and is consistent with modern C++ best practices.

Closes #275

hesam-oxe avatar Jun 11 '26 12:06 hesam-oxe

CLA Not Signed

  • :x: - login: @hesam-oxe / name: hesam-oxe. The commit (69b7063bafa83aa193f3178adb5e763271ed8713, d366babe37f8835b2278fb150b905cb977fd51cf) is not authorized under a signed CLA. Please click here to be authorized. For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

Thanks for looking into this. I see you included the changes from 278 here. It is better to only have relevant changes in each PR. The 278 was fine, apart from missing the CLA.

Unfortunately we can not accept contributions without a signed CLA. Please get that sorted if you can.

antond-weta avatar Jun 13 '26 04:06 antond-weta