Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63718

Document conversion task should fail if any document could not be converted

XMLWordPrintable

    • MOODLE_35_STABLE
    • MOODLE_39_STABLE
    • MDL-63718-throw-exception-when-conversion-failed-master
    • Hide

      If file conversions fails for some reason, code doesn't stop the execution and queue is cleaned so failed conversion can't be restarted

      1. Use Moodle 3.5
      2. Install attached pseudo async plugin fileconverter_example.zip  (copied from MDL-55528).
      3. Install ghostcript and unoconv on server 

        apt install ghostscript
         
        apt install unoconv
        

      1. Enable plugin in admin/settings.php?section=managefileconverterplugins
      2. Disable all other file converters
      3. Create assignment with file submission and enable annotations
      4. Submit file to assignment in format other than pdf - for example odt
      5. Run scheduled task

        php admin/tool/task/cli/schedule_task.php --execute='\assignfeedback_editpdf\task\convert_submissions'

      Expected behaviour: exception is thrown. Task can be restarted and process failed submission

      Actual behaviour: you will see error

      Conversion failed with error:Could not find readonly pages for grade 37342

      But code will keep execution and cleans up the queue, so task restart won't process failed submissions

      Show
      If file conversions fails for some reason, code doesn't stop the execution and queue is cleaned so failed conversion can't be restarted Use Moodle 3.5 Install attached pseudo async plugin fileconverter_example.zip  (copied from MDL-55528 ). Install ghostcript and unoconv on server  apt install ghostscript   apt install unoconv Enable plugin in admin/settings.php?section=managefileconverterplugins Disable all other file converters Create assignment with file submission and enable annotations Submit file to assignment in format other than pdf - for example odt Run scheduled task php admin/tool/task/cli/schedule_task.php --execute= '\assignfeedback_editpdf\task\convert_submissions' Expected behaviour: exception is thrown. Task can be restarted and process failed submission Actual behaviour: you will see error Conversion failed with error:Could not find readonly pages for grade 37342 But code will keep execution and cleans up the queue, so task restart won't process failed submissions

      File: mod/assign/feedback/editpdf/classes/task/convert_submissions.php
      Function: execute()

      The bit of code that actually does the conversion is (for no clear reason) wrapped in a try..catch block. All it does is float a different error. 

      This is (IMO) both pointless and masks the real error if anything does go wrong.

      Suggest removing the try..catch

            Unassigned Unassigned
            howardsmiller Howard Miller
            Matt Porritt Matt Porritt
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 10 minutes
                4h 10m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.