handle() public method

Handle the exception provided.
public handle ( Exception $e ) : Tobscure\JsonApi\Exception\Handler\ResponseBag
$e Exception
return Tobscure\JsonApi\Exception\Handler\ResponseBag
Esempio n. 1
0
 /**
  * @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());
 }
Esempio n. 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());
 }