/** * Creates a valid JobStepResponse object from an exception and method name. * @param \Exception $exception * @param string $method_name * @return JobStepResponse */ protected function _get_error_response(\Exception $exception, $method_name) { if (!$this->_job_parameters instanceof JobParameters) { $this->_job_parameters = new JobParameters($this->_job_id, __('__Unknown__', 'event_espresso'), array()); } $this->_job_parameters->set_status(JobParameters::status_error); return new JobStepResponse($this->_job_parameters, sprintf(__('An exception of type %1$s occurred while running %2$s. Its message was %3$s and had trace %4$s', 'event_espresso'), get_class($exception), 'BatchRunner::' . $method_name . '()', $exception->getMessage(), $exception->getTraceAsString())); }
/** * Performs any clean-up logic when we know the job is completed. * In this case, we delete the temporary file * @param JobParameters $job_parameters * @return boolean */ public function cleanup_job(JobParameters $job_parameters) { $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), true, 'd'); return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); }