Skip to content

Refactor of error codes in import/export filters

I've changed KisImageBuilder_RESULT and ConversionStatus to KisImportExportErrorCode to unify error handling in import/export filters.

In the process I fixed some bugs and silent failures like:

  • parsing errors in xcf library causing crash;
  • saving tiff file to readonly location causing crash;
  • saving exr file to readonly location causing std::exception and infinite waiting or silent failure;
  • silent failure of saving spriter file to readonly location;
  • crash when opening a preasumbly heightmap file that had 0 bytes;

I added tests that checks if import/export filters handles edge cases and broken files properly:

  • saving to readonly location (no permission to write)
  • opening from writeonly file (no permission to read)
  • opening an empty file (incorrect format)

Test Plan

  • Go to ./build/plugins/impex and run 'make test'. There are three tests that fails now:

    • ora (it has nearly no error handling, so it fails the test)
    • svg (the same as ora)
    • exr (make sure to click "OK", then the relevant test will pass - but there is still a test that fails on master and on my branch too which is not relevant to changes I've made, so 'make test' will show kis_exr_test as failed. Make sure to run 'exr/tests/kis_exr_test' to check if new tests pass)
  • Open Krita and open/save files in different formats

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Agata Cacko

Merge request reports

Loading