{"action":"created","issue":{"url":"https://api.github.com/repos/construct/construct/issues/48","repository_url":"https://api.github.com/repos/construct/construct","labels_url":"https://api.github.com/repos/construct/construct/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/construct/construct/issues/48/comments","events_url":"https://api.github.com/repos/construct/construct/issues/48/events","html_url":"https://github.com/construct/construct/issues/48","id":51319803,"number":48,"title":"Over broad exception catching (except Exception)","user":{"login":"joneskoo","id":305104,"avatar_url":"https://avatars.githubusercontent.com/u/305104?v=3","gravatar_id":"","url":"https://api.github.com/users/joneskoo","html_url":"https://github.com/joneskoo","followers_url":"https://api.github.com/users/joneskoo/followers","following_url":"https://api.github.com/users/joneskoo/following{/other_user}","gists_url":"https://api.github.com/users/joneskoo/gists{/gist_id}","starred_url":"https://api.github.com/users/joneskoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joneskoo/subscriptions","organizations_url":"https://api.github.com/users/joneskoo/orgs","repos_url":"https://api.github.com/users/joneskoo/repos","events_url":"https://api.github.com/users/joneskoo/events{/privacy}","received_events_url":"https://api.github.com/users/joneskoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2014-12-08T16:16:55Z","updated_at":"2016-09-04T10:54:10Z","closed_at":null,"body":"I have an issue where I'm running pyelftools and need to interrupt processing. I'm calling pyelftools from a Celery task. Celery cancels tasks by raising an celery.exceptions.Terminated exception. I have traced the offending except Exception to construct library where it needs to be fixed.\r\n\r\nDue to the problem, I can't reliably cancel my task as sometimes construct except Exception will eat my celery exception and as far as I know there's no way to work around it.\r\n\r\nAs a fix, all occurences of except Exception should be changed to catch more specific exceptions, such as IOError, ValueError etc.\r\n\r\nExample of an offending exception:\r\nhttps://github.com/construct/construct/blob/master/construct/core.py#L364\r\n\r\n```\r\n\r\n$ git grep --line-number \"except Exception\"\r\nconstruct/core.py:246:        except Exception:\r\nconstruct/core.py:364:        except Exception:\r\nconstruct/core.py:369:        except Exception:\r\nconstruct/core.py:928:                except Exception:\r\nconstruct/core.py:1398:        except Exception:\r\nconstruct/core.py:1405:        except Exception:\r\nconstruct/debug.py:110:        except Exception:\r\nconstruct/debug.py:121:        except Exception:\r\n```\r\n\r\nThis is follow-up from https://github.com/eliben/pyelftools/issues/59 where they told me construct is upstream so here I am."},"comment":{"url":"https://api.github.com/repos/construct/construct/issues/comments/244596268","html_url":"https://github.com/construct/construct/issues/48#issuecomment-244596268","issue_url":"https://api.github.com/repos/construct/construct/issues/48","id":244596268,"user":{"login":"arekbulski","id":5385838,"avatar_url":"https://avatars.githubusercontent.com/u/5385838?v=3","gravatar_id":"","url":"https://api.github.com/users/arekbulski","html_url":"https://github.com/arekbulski","followers_url":"https://api.github.com/users/arekbulski/followers","following_url":"https://api.github.com/users/arekbulski/following{/other_user}","gists_url":"https://api.github.com/users/arekbulski/gists{/gist_id}","starred_url":"https://api.github.com/users/arekbulski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekbulski/subscriptions","organizations_url":"https://api.github.com/users/arekbulski/orgs","repos_url":"https://api.github.com/users/arekbulski/repos","events_url":"https://api.github.com/users/arekbulski/events{/privacy}","received_events_url":"https://api.github.com/users/arekbulski/received_events","type":"User","site_admin":false},"created_at":"2016-09-04T10:54:10Z","updated_at":"2016-09-04T10:54:10Z","body":"Some are broad by design I think. Debuggers should use broad."}}
{"actor":{"display_login":"arekbulski"}}