Example #1
0
 /** 
  * In case of exception: undo everything.
  * @throws Exception if even the undo isn't working. 
  */
 private function undoCreation($ids, $error = null)
 {
     // TODO use platformjobid.
     Log::debug("Attempting to delete jobs from crowdsourcing platform.");
     try {
         $this->getPlatform()->undoCreation($ids);
     } catch (Exception $e) {
         // This is bad.
         if ($error) {
             $orige = $error->getMessage();
         } else {
             $orige = 'None.';
         }
         $newe = $e->getMessage();
         throw new Exception("WARNING. There was an error in uploading the jobs. We could not undo all the steps. \n\t\t\t\tPlease check the platforms manually and delete any uploaded jobs.\n\t\t\t\t<br>Initial exception: {$orige}\n\t\t\t\t<br>Deletion error: {$newe}\n\t\t\t\t<br>Please contact an administrator.");
         Log::warning("Couldn't delete jobs. Please manually check the platforms and database.\r\nInitial exception: {$orige}\n\t\t\t\t\r\nDeletion error: {$newe}\r\nActivity: {$this->activityURI}\r\nJob ID's: " . json_encode($ids));
     }
 }