Catch CPLNotFoundError more nicely.
[dcpomatic.git] / src / lib / job.cc
index 5bed3f0d273c6b5216ce2bb0c67b3b52c3953db2..8ce63ced0213d66ea2c03dce79bd3a29579562d0 100644 (file)
@@ -235,6 +235,12 @@ Job::run_wrapper ()
                set_progress (1);
                set_state (FINISHED_ERROR);
 
+       } catch (CPLNotFoundError& e) {
+
+               set_error(e.what());
+               set_progress(1);
+               set_state(FINISHED_ERROR);
+
        } catch (std::exception& e) {
 
                set_error (
@@ -589,17 +595,13 @@ Job::remaining_time () const
 void
 Job::cancel ()
 {
-       if (!_thread.joinable()) {
-               return;
-       }
+       if (_thread.joinable()) {
+               resume();
 
-       if (paused_by_user() || paused_by_priority()) {
-               resume ();
+               _thread.interrupt ();
+               _thread.join ();
        }
 
-       _thread.interrupt ();
-       _thread.join ();
-
        set_state (FINISHED_CANCELLED);
 }