public function handleException(Exception $e, Request $request, Response $response)
 {
     $response->clearHeaders();
     $hdr = "HTTP/1.1 {$e->getCode()} {$e->getHeaderMessage()}";
     $response->header($hdr);
     foreach ($e->getHeaders() as $hdr) {
         $response->header($hdr);
     }
     $response->setData($e->getMessage());
 }
 public function handleException(Exception $e, Request $request, Response $response)
 {
     $response->clearHeaders();
     $code = 500;
     $hdrMsg = RestException::$HEADER_MESSAGES[$code];
     $msg = RestException::$MESSAGES[$code];
     $hdr = "HTTP/1.1 {$code} {$hdrMsg}";
     $response->header($hdr);
     $response->setData($msg);
 }