public function onActionException(MWP_Event_ActionException $event) { $action = $event->getRequest()->getAction(); if ($action !== 'fetch_files' && $action !== 'dump_tables') { return; } $event->stopPropagation(); parent::onActionException($event); $parts = array(); $parts[] = new MWP_Http_MultipartResponsePart(array('content-type' => 'application/json', 'x-mwp-error' => 'error'), json_encode($event->getData())); $event->setResponse(new MWP_Http_MultipartResponse($parts, $this->boundary)); }
public function onActionException(MWP_Event_ActionException $event) { $exception = $event->getException(); $verbose = $event->getRequest()->isAuthenticated(); if ($exception instanceof MWP_Worker_Exception) { $exceptionData = $this->getDataForWorkerException($exception, $verbose); } else { $exceptionData = $this->getDataForGenericException($exception, $verbose); } $data = array('error' => $exception->getMessage(), 'exception' => $exceptionData); $event->setData($data); }
public function onActionException(MWP_Event_ActionException $event) { $event->setResponse($this->getResponseForRequest($event->getRequest(), $event->getData())); }