*/ class ExceptionInterpreter extends ExceptionInterpretor { const FILESYSTEM_ID_TO_LOG = 'log'; /** * @var LtiException */ protected $exception; /** * set exception to interpet * @param \Exception $exception * @return ExceptionInterpretor */ public function setException(\Exception $exception) { parent::setException($exception); return $this; } /** * return an instance of ResponseInterface * @return ResponseInterface */ public function getResponse() { $this->log((string) $this->exception); $response = new LtiReturnResponse(new \Renderer()); $response->setServiceLocator($this->getServiceLocator()); $response->setException($this->exception); return $response; } private function log($msg) { if (!$this->exception instanceof LtiException) { return; } /** @var FileSystem $fs */ $fs = $this->getServiceLocator() ->get(FileSystemService::SERVICE_ID) ->getFileSystem(self::FILESYSTEM_ID_TO_LOG); $fs->put('lti_' . $this->exception->getKey() . '.log', $msg); } }