{"action":"created","comment":{"url":"https://api.github.com/repos/contao/core-bundle/pulls/comments/27559097","id":27559097,"diff_hunk":"@@ -393,20 +386,20 @@ public function executePostActions(\\DataContainer $dc)\n \t\t\t\t\tif (\\Input::post('load'))\n \t\t\t\t\t{\n \t\t\t\t\t\t\\Config::set(\\Input::post('field'), $val);\n-\t\t\t\t\t\techo $dc->edit(false, \\Input::post('id'));\n+\t\t\t\t\t\tthrow ResponseException::create($dc->edit(false, \\Input::post('id')));\n \t\t\t\t\t}\n \t\t\t\t}\n-\t\t\t\texit; break;\n+\t\t\t\tthrow ResponseException::create('', 204);\n \n \t\t\t// DropZone file upload\n \t\t\tcase 'fileupload':\n \t\t\t\t$dc->move();\n-\t\t\t\texit; break;\n+\t\t\t\tthrow ResponseException::create('', 204);","path":"src/Resources/contao/classes/Ajax.php","position":187,"original_position":187,"commit_id":"80702581eb8bc82a5f966501e1f01bd7707c2952","original_commit_id":"80702581eb8bc82a5f966501e1f01bd7707c2952","user":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"body":"Is there no such thing as a `NoContentResponseException`?","created_at":"2015-04-01T10:40:37Z","updated_at":"2015-04-01T10:40:37Z","html_url":"https://github.com/contao/core-bundle/pull/70#discussion_r27559097","pull_request_url":"https://api.github.com/repos/contao/core-bundle/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/comments/27559097"},"html":{"href":"https://github.com/contao/core-bundle/pull/70#discussion_r27559097"},"pull_request":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/contao/core-bundle/pulls/70","id":31582203,"html_url":"https://github.com/contao/core-bundle/pull/70","diff_url":"https://github.com/contao/core-bundle/pull/70.diff","patch_url":"https://github.com/contao/core-bundle/pull/70.patch","issue_url":"https://api.github.com/repos/contao/core-bundle/issues/70","number":70,"state":"open","locked":false,"title":"[RFC] Feature/exception listener.","user":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"body":"This PR is currently a moving target.\r\n\r\nPretty error rendering is enabled by default keep the behaviour known from Contao 3.X.\r\nTo disable it, put the following into your `config_dev.yml`:\r\n```diff\r\n+contao:\r\n+    pretty_error_screens: false\r\n```\r\n\r\nTODO\r\n=====\r\n- [X] Introduce Exception classes for all `die_nicely()` calls.\r\n- [X] Add rendering of exceptions in exception handler.\r\n- [X] Replace occurences of `exit` with proper exception throwing where possible.\r\n- [ ] Introduce proper error logging (probably a separate PR).\r\n- [ ] Absorb 25dec35453f393debdf9d33c1a53d3a4551429bd from @Toflar's PR for streaming files.\r\n\r\nCaveats and stuff to be aware of:\r\n==========================\r\n1. the error logging is still being set in the `InitializeSystemListener::boot()`.\r\n2. I had to alter the error handling to remove E_NOTICE etc. in the beginning of `InitializeSystemListener::boot()` as otherwise the whole legacy code will break in the console (automator command) as it is riddled with notices.\r\n3. I had to remove the exception and error handlers from `functions.php` as they were rendering the default symfony error and exception handling useless.\r\n4. The whole monolog handling is still missing, I wonder if we should configure it in the standard-distribution and inject the kernel and/or logger into the listener. I am as of now undecided which way to go.\r\n\r\nHow to use the new exceptions:\r\n=========================\r\n\r\nAjax responses with \"No Content\".\r\n----------------------------------------------\r\nOld:\r\n```php\r\n    header('HTTP/1.1 204 No Content');\r\n    header('X-Ajax-Location: ' . $strLocation);\r\n    exit;\r\n```\r\nNew:\r\n```php\r\nthrow RedirectResponseException::createAjax($location);\r\n```\r\n\r\nRedirect:\r\n----------------------------------------------\r\nOld:\r\n```php\r\n// Simple redirect.\r\nController::redirect($strLocation);\r\n// Simple redirect with status.\r\nController::redirect($strLocation, 301);\r\n```\r\n\r\nNew:\r\n```php\r\n// Simple redirect (HTTP 303).\r\nthrow RedirectResponseException::create($location);\r\n// Simple redirect with status 301.\r\nthrow RedirectResponseException::create($location, 301);\r\n// Provide additional header.\r\nthrow RedirectResponseException::create($location, 301, ['Auth-Token' => 'something']);\r\n```\r\n\r\nFile::sendToBrowser()\r\n----------------------------\r\nFor this one we will use a streaming response to lower load.\r\nFetch code from: 25dec35453f393debdf9d33c1a53d3a4551429bd","created_at":"2015-03-20T01:44:14Z","updated_at":"2015-04-01T10:40:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"04b9457a6998f9d75707340195fec4163230060a","assignee":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/contao/core-bundle/milestones/1","html_url":"https://github.com/contao/core-bundle/milestones/4.0.0","labels_url":"https://api.github.com/repos/contao/core-bundle/milestones/1/labels","id":748885,"number":1,"title":"4.0.0","description":"Contao 4.0.0 (major release)","creator":{"login":"leofeyer","id":1192057,"avatar_url":"https://avatars.githubusercontent.com/u/1192057?v=3","gravatar_id":"","url":"https://api.github.com/users/leofeyer","html_url":"https://github.com/leofeyer","followers_url":"https://api.github.com/users/leofeyer/followers","following_url":"https://api.github.com/users/leofeyer/following{/other_user}","gists_url":"https://api.github.com/users/leofeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/leofeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leofeyer/subscriptions","organizations_url":"https://api.github.com/users/leofeyer/orgs","repos_url":"https://api.github.com/users/leofeyer/repos","events_url":"https://api.github.com/users/leofeyer/events{/privacy}","received_events_url":"https://api.github.com/users/leofeyer/received_events","type":"User","site_admin":false},"open_issues":25,"closed_issues":93,"state":"open","created_at":"2014-08-10T18:11:38Z","updated_at":"2015-04-01T10:26:44Z","due_on":"2015-05-25T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/contao/core-bundle/pulls/70/commits","review_comments_url":"https://api.github.com/repos/contao/core-bundle/pulls/70/comments","review_comment_url":"https://api.github.com/repos/contao/core-bundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/contao/core-bundle/issues/70/comments","statuses_url":"https://api.github.com/repos/contao/core-bundle/statuses/80702581eb8bc82a5f966501e1f01bd7707c2952","head":{"label":"discordier:feature/exception-listener","ref":"feature/exception-listener","sha":"80702581eb8bc82a5f966501e1f01bd7707c2952","user":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"repo":{"id":25869758,"name":"core-bundle","full_name":"discordier/core-bundle","owner":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/discordier/core-bundle","description":"Contao 4 core module","fork":true,"url":"https://api.github.com/repos/discordier/core-bundle","forks_url":"https://api.github.com/repos/discordier/core-bundle/forks","keys_url":"https://api.github.com/repos/discordier/core-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/discordier/core-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/discordier/core-bundle/teams","hooks_url":"https://api.github.com/repos/discordier/core-bundle/hooks","issue_events_url":"https://api.github.com/repos/discordier/core-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/discordier/core-bundle/events","assignees_url":"https://api.github.com/repos/discordier/core-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/discordier/core-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/discordier/core-bundle/tags","blobs_url":"https://api.github.com/repos/discordier/core-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/discordier/core-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/discordier/core-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/discordier/core-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/discordier/core-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/discordier/core-bundle/languages","stargazers_url":"https://api.github.com/repos/discordier/core-bundle/stargazers","contributors_url":"https://api.github.com/repos/discordier/core-bundle/contributors","subscribers_url":"https://api.github.com/repos/discordier/core-bundle/subscribers","subscription_url":"https://api.github.com/repos/discordier/core-bundle/subscription","commits_url":"https://api.github.com/repos/discordier/core-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/discordier/core-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/discordier/core-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/discordier/core-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/discordier/core-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/discordier/core-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/discordier/core-bundle/merges","archive_url":"https://api.github.com/repos/discordier/core-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/discordier/core-bundle/downloads","issues_url":"https://api.github.com/repos/discordier/core-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/discordier/core-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/discordier/core-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/discordier/core-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/discordier/core-bundle/labels{/name}","releases_url":"https://api.github.com/repos/discordier/core-bundle/releases{/id}","created_at":"2014-10-28T13:09:14Z","updated_at":"2015-03-20T01:11:03Z","pushed_at":"2015-03-30T16:31:16Z","git_url":"git://github.com/discordier/core-bundle.git","ssh_url":"git@github.com:discordier/core-bundle.git","clone_url":"https://github.com/discordier/core-bundle.git","svn_url":"https://github.com/discordier/core-bundle","homepage":null,"size":20254,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"contao:develop","ref":"develop","sha":"5c9274a2ff48aedbd7d9dd5ce2ecc95994cb20ef","user":{"login":"contao","id":1206136,"avatar_url":"https://avatars.githubusercontent.com/u/1206136?v=3","gravatar_id":"","url":"https://api.github.com/users/contao","html_url":"https://github.com/contao","followers_url":"https://api.github.com/users/contao/followers","following_url":"https://api.github.com/users/contao/following{/other_user}","gists_url":"https://api.github.com/users/contao/gists{/gist_id}","starred_url":"https://api.github.com/users/contao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contao/subscriptions","organizations_url":"https://api.github.com/users/contao/orgs","repos_url":"https://api.github.com/users/contao/repos","events_url":"https://api.github.com/users/contao/events{/privacy}","received_events_url":"https://api.github.com/users/contao/received_events","type":"Organization","site_admin":false},"repo":{"id":20519851,"name":"core-bundle","full_name":"contao/core-bundle","owner":{"login":"contao","id":1206136,"avatar_url":"https://avatars.githubusercontent.com/u/1206136?v=3","gravatar_id":"","url":"https://api.github.com/users/contao","html_url":"https://github.com/contao","followers_url":"https://api.github.com/users/contao/followers","following_url":"https://api.github.com/users/contao/following{/other_user}","gists_url":"https://api.github.com/users/contao/gists{/gist_id}","starred_url":"https://api.github.com/users/contao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/contao/subscriptions","organizations_url":"https://api.github.com/users/contao/orgs","repos_url":"https://api.github.com/users/contao/repos","events_url":"https://api.github.com/users/contao/events{/privacy}","received_events_url":"https://api.github.com/users/contao/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/contao/core-bundle","description":"Contao 4 core bundle","fork":false,"url":"https://api.github.com/repos/contao/core-bundle","forks_url":"https://api.github.com/repos/contao/core-bundle/forks","keys_url":"https://api.github.com/repos/contao/core-bundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/contao/core-bundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/contao/core-bundle/teams","hooks_url":"https://api.github.com/repos/contao/core-bundle/hooks","issue_events_url":"https://api.github.com/repos/contao/core-bundle/issues/events{/number}","events_url":"https://api.github.com/repos/contao/core-bundle/events","assignees_url":"https://api.github.com/repos/contao/core-bundle/assignees{/user}","branches_url":"https://api.github.com/repos/contao/core-bundle/branches{/branch}","tags_url":"https://api.github.com/repos/contao/core-bundle/tags","blobs_url":"https://api.github.com/repos/contao/core-bundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/contao/core-bundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/contao/core-bundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/contao/core-bundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/contao/core-bundle/statuses/{sha}","languages_url":"https://api.github.com/repos/contao/core-bundle/languages","stargazers_url":"https://api.github.com/repos/contao/core-bundle/stargazers","contributors_url":"https://api.github.com/repos/contao/core-bundle/contributors","subscribers_url":"https://api.github.com/repos/contao/core-bundle/subscribers","subscription_url":"https://api.github.com/repos/contao/core-bundle/subscription","commits_url":"https://api.github.com/repos/contao/core-bundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/contao/core-bundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/contao/core-bundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/contao/core-bundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/contao/core-bundle/contents/{+path}","compare_url":"https://api.github.com/repos/contao/core-bundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/contao/core-bundle/merges","archive_url":"https://api.github.com/repos/contao/core-bundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/contao/core-bundle/downloads","issues_url":"https://api.github.com/repos/contao/core-bundle/issues{/number}","pulls_url":"https://api.github.com/repos/contao/core-bundle/pulls{/number}","milestones_url":"https://api.github.com/repos/contao/core-bundle/milestones{/number}","notifications_url":"https://api.github.com/repos/contao/core-bundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/contao/core-bundle/labels{/name}","releases_url":"https://api.github.com/repos/contao/core-bundle/releases{/id}","created_at":"2014-06-05T09:45:55Z","updated_at":"2015-04-01T09:58:18Z","pushed_at":"2015-04-01T09:58:17Z","git_url":"git://github.com/contao/core-bundle.git","ssh_url":"git@github.com:contao/core-bundle.git","clone_url":"https://github.com/contao/core-bundle.git","svn_url":"https://github.com/contao/core-bundle","homepage":"","size":24866,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":29,"forks":8,"open_issues":29,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/70"},"html":{"href":"https://github.com/contao/core-bundle/pull/70"},"issue":{"href":"https://api.github.com/repos/contao/core-bundle/issues/70"},"comments":{"href":"https://api.github.com/repos/contao/core-bundle/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/contao/core-bundle/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/contao/core-bundle/statuses/80702581eb8bc82a5f966501e1f01bd7707c2952"}}}}