{"action":"created","issue":{"url":"https://api.github.com/repos/middlewares/error-handler/issues/1","repository_url":"https://api.github.com/repos/middlewares/error-handler","labels_url":"https://api.github.com/repos/middlewares/error-handler/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/middlewares/error-handler/issues/1/comments","events_url":"https://api.github.com/repos/middlewares/error-handler/issues/1/events","html_url":"https://github.com/middlewares/error-handler/issues/1","id":199508698,"number":1,"title":"Error content not displayed","user":{"login":"Wikiki","id":24766179,"avatar_url":"https://avatars.githubusercontent.com/u/24766179?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikiki","html_url":"https://github.com/Wikiki","followers_url":"https://api.github.com/users/Wikiki/followers","following_url":"https://api.github.com/users/Wikiki/following{/other_user}","gists_url":"https://api.github.com/users/Wikiki/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikiki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikiki/subscriptions","organizations_url":"https://api.github.com/users/Wikiki/orgs","repos_url":"https://api.github.com/users/Wikiki/repos","events_url":"https://api.github.com/users/Wikiki/events{/privacy}","received_events_url":"https://api.github.com/users/Wikiki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-01-09T09:33:09Z","updated_at":"2017-01-09T21:08:25Z","closed_at":null,"body":"Hi,\r\n\r\nI set this middleware at the top of the stack, The errors and exception are well intercepted (I saw them into my Logger) but my response content is not displayed.\r\n\r\nI use the following code:\r\n`( new Middlewares\\ErrorHandler( 'App::errorHandler' ) )->catchExceptions( true ),`\r\n\r\nAnd my handler is like\r\n```\r\nstatic public function errorHandler( ServerRequestInterface $request ) {\r\n    //Get the error info using the \"error\" attribute\r\n    $error = $request->getAttribute( 'error' );\r\n    $response = ( new Response() )->withStatus( $error[ 'status_code' ] );\r\n\r\n    switch ( $error['status_code'] ) {\r\n      case 404:\r\n        App::$view->setView( 'errorNotFound' );\r\n        $output = App::$view->__invoke();\r\n        $response->getBody()->write( $output );\r\n\r\n      case 503:\r\n        App::$view->setView( 'maintenance' );\r\n        $output = App::$view->__invoke();\r\n        $response->getBody()->write( $output );\r\n\r\n      default:\r\n        App::$logger->debug( $error[ 'exception' ]->getMessage() );\r\n        App::$view->setView( 'errorServer' );\r\n        $output = App::$view->__invoke();\r\n        $response->getBody()->write( $output );\r\n    }\r\n\r\n    return $response;\r\n  }\r\n```\r\n\r\nWhat am I doing wrong ?"},"comment":{"url":"https://api.github.com/repos/middlewares/error-handler/issues/comments/271408189","html_url":"https://github.com/middlewares/error-handler/issues/1#issuecomment-271408189","issue_url":"https://api.github.com/repos/middlewares/error-handler/issues/1","id":271408189,"user":{"login":"oscarotero","id":377873,"avatar_url":"https://avatars.githubusercontent.com/u/377873?v=3","gravatar_id":"","url":"https://api.github.com/users/oscarotero","html_url":"https://github.com/oscarotero","followers_url":"https://api.github.com/users/oscarotero/followers","following_url":"https://api.github.com/users/oscarotero/following{/other_user}","gists_url":"https://api.github.com/users/oscarotero/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarotero/subscriptions","organizations_url":"https://api.github.com/users/oscarotero/orgs","repos_url":"https://api.github.com/users/oscarotero/repos","events_url":"https://api.github.com/users/oscarotero/events{/privacy}","received_events_url":"https://api.github.com/users/oscarotero/received_events","type":"User","site_admin":false},"created_at":"2017-01-09T21:08:25Z","updated_at":"2017-01-09T21:08:25Z","body":"Middleman is using an old version of the PSR-15 interface (`0.2` instead the current `0.4`). I recommend using the dispatcher from Middleware\\Utils.\r\nAnyway, I suspect this is a bug in your code:\r\n\r\n* You should add a `break` after each case in the switch\r\n* If you don't see the response, are you sure the body has content?\r\n* Is being the response emitted?"}}
{"actor":{"display_login":"oscarotero"}}