handle() 공개 메소드

Handle the exception provided.
public handle ( Exception $e ) : Tobscure\JsonApi\Exception\Handler\ResponseBag
$e Exception
리턴 Tobscure\JsonApi\Exception\Handler\ResponseBag
예제 #1
0
파일: ErrorHandler.php 프로젝트: clops/core
 /**
  * @param Exception $e
  * @return JsonApiResponse
  */
 public function handle(Exception $e)
 {
     $response = $this->errorHandler->handle($e);
     $document = new Document();
     $document->setErrors($response->getErrors());
     return new JsonApiResponse($document, $response->getStatus());
 }
예제 #2
0
 public function test_it_should_throw_an_exception_when_no_handlers_are_present()
 {
     $this->setExpectedException('RuntimeException');
     $handler = new ErrorHandler();
     $handler->handle(new Exception());
 }