{"action":"created","issue":{"url":"https://api.github.com/repos/reactphp/promise/issues/131","repository_url":"https://api.github.com/repos/reactphp/promise","labels_url":"https://api.github.com/repos/reactphp/promise/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/reactphp/promise/issues/131/comments","events_url":"https://api.github.com/repos/reactphp/promise/issues/131/events","html_url":"https://github.com/reactphp/promise/issues/131","id":393692736,"node_id":"MDU6SXNzdWUzOTM2OTI3MzY=","number":131,"title":"Reset of error handler in Promise\\fatalError","user":{"login":"CharlotteDunois","id":4529744,"node_id":"MDQ6VXNlcjQ1Mjk3NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4529744?v=4","gravatar_id":"","url":"https://api.github.com/users/CharlotteDunois","html_url":"https://github.com/CharlotteDunois","followers_url":"https://api.github.com/users/CharlotteDunois/followers","following_url":"https://api.github.com/users/CharlotteDunois/following{/other_user}","gists_url":"https://api.github.com/users/CharlotteDunois/gists{/gist_id}","starred_url":"https://api.github.com/users/CharlotteDunois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharlotteDunois/subscriptions","organizations_url":"https://api.github.com/users/CharlotteDunois/orgs","repos_url":"https://api.github.com/users/CharlotteDunois/repos","events_url":"https://api.github.com/users/CharlotteDunois/events{/privacy}","received_events_url":"https://api.github.com/users/CharlotteDunois/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-22T18:10:56Z","updated_at":"2018-12-27T09:11:18Z","closed_at":null,"author_association":"NONE","body":"Is there any reason why the internal function `fatalError` resets the error handler, even though the library does not even set one in the first place? A nasty side effect of this is that it removes an user defined error handler - in my case would that be a throwing error handler, leading to regular PHP errors, which can't be handled through try-catch.\r\n\r\nhttps://github.com/reactphp/promise/blob/c1aad8e65d6406fd361f8975194a094d06c83793/src/functions.php#L209-L220\r\n\r\nThe relevant [commit](https://github.com/reactphp/promise/commit/23cd28cd2d42105fb5442c2c2caec81026ddd550) for this does not mention why a reset is necessary."},"comment":{"url":"https://api.github.com/repos/reactphp/promise/issues/comments/450110274","html_url":"https://github.com/reactphp/promise/issues/131#issuecomment-450110274","issue_url":"https://api.github.com/repos/reactphp/promise/issues/131","id":450110274,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDExMDI3NA==","user":{"login":"CharlotteDunois","id":4529744,"node_id":"MDQ6VXNlcjQ1Mjk3NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/4529744?v=4","gravatar_id":"","url":"https://api.github.com/users/CharlotteDunois","html_url":"https://github.com/CharlotteDunois","followers_url":"https://api.github.com/users/CharlotteDunois/followers","following_url":"https://api.github.com/users/CharlotteDunois/following{/other_user}","gists_url":"https://api.github.com/users/CharlotteDunois/gists{/gist_id}","starred_url":"https://api.github.com/users/CharlotteDunois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CharlotteDunois/subscriptions","organizations_url":"https://api.github.com/users/CharlotteDunois/orgs","repos_url":"https://api.github.com/users/CharlotteDunois/repos","events_url":"https://api.github.com/users/CharlotteDunois/events{/privacy}","received_events_url":"https://api.github.com/users/CharlotteDunois/received_events","type":"User","site_admin":false},"created_at":"2018-12-27T09:11:18Z","updated_at":"2018-12-27T09:11:18Z","author_association":"NONE","body":"That is the intention of the whole function, yes. But I dont really get why there is a try catch block. If I throw an exception from my error handler, a library shouldn't catch it, unset my error handler and trigger it as regular error again. The intention of trying to abort the program and overwrite an user defined behaviour of what happens when a PHP error gets triggered shouldn't be modified to get the intended result. Exactly because `done` does not catch an exception I could use this behaviour to fallback to some sort of top level catch block to apply custom logic. However due to the behaviour of trying to catch an exception from triggering an error, the user defined error handler gets overwritten. In the end if the error handler just does something else than triggering an exception (like just log the error and good), your intentions are never executed. In my opinion the try catch block should be removed, exactly because you can never exactly fulfill it and because you overwrite an user defined behaviour."}}
{"actor":{"display_login":"CharlotteDunois"}}