{"action":"created","issue":{"url":"https://api.github.com/repos/rg3/youtube-dl/issues/10945","repository_url":"https://api.github.com/repos/rg3/youtube-dl","labels_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10945/labels{/name}","comments_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10945/comments","events_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10945/events","html_url":"https://github.com/rg3/youtube-dl/pull/10945","id":183399759,"number":10945,"title":"[utils] add a base exception class and initialize exceptions properly","user":{"login":"mdawar","id":4085845,"avatar_url":"https://avatars.githubusercontent.com/u/4085845?v=3","gravatar_id":"","url":"https://api.github.com/users/mdawar","html_url":"https://github.com/mdawar","followers_url":"https://api.github.com/users/mdawar/followers","following_url":"https://api.github.com/users/mdawar/following{/other_user}","gists_url":"https://api.github.com/users/mdawar/gists{/gist_id}","starred_url":"https://api.github.com/users/mdawar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdawar/subscriptions","organizations_url":"https://api.github.com/users/mdawar/orgs","repos_url":"https://api.github.com/users/mdawar/repos","events_url":"https://api.github.com/users/mdawar/events{/privacy}","received_events_url":"https://api.github.com/users/mdawar/received_events","type":"User","site_admin":false},"labels":[{"id":394545246,"url":"https://api.github.com/repos/rg3/youtube-dl/labels/pending-fixes","name":"pending-fixes","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-17T12:13:48Z","updated_at":"2016-11-02T10:30:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rg3/youtube-dl/pulls/10945","html_url":"https://github.com/rg3/youtube-dl/pull/10945","diff_url":"https://github.com/rg3/youtube-dl/pull/10945.diff","patch_url":"https://github.com/rg3/youtube-dl/pull/10945.patch"},"body":"It's always a good practice to have a base exception class and inherit from it, this way when handling exceptions you can differentiate the library errors from other exceptions, for example handling `Exception` will catch all the exceptions of youtube-dl and any other exceptions based on `Exception`, but now you can handle `YoutubeDLError` and `Exception` separately:\n\n``` python\ntry:\n    youtubedl = YoutubeDL(url, options)\n    # ...\nexcept YoutubeDLError:\n    # handle all YoutubeDL errors\nexcept Exception:\n    # handle all the other exceptions\n\n```\n\nAlso 2 exception classes didn't call the parent's `__init__` which is recommended and will set the `args` attribute of the exception which is used by the `__str__` and `__repr__` methods.\n"},"comment":{"url":"https://api.github.com/repos/rg3/youtube-dl/issues/comments/257827571","html_url":"https://github.com/rg3/youtube-dl/pull/10945#issuecomment-257827571","issue_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10945","id":257827571,"user":{"login":"mdawar","id":4085845,"avatar_url":"https://avatars.githubusercontent.com/u/4085845?v=3","gravatar_id":"","url":"https://api.github.com/users/mdawar","html_url":"https://github.com/mdawar","followers_url":"https://api.github.com/users/mdawar/followers","following_url":"https://api.github.com/users/mdawar/following{/other_user}","gists_url":"https://api.github.com/users/mdawar/gists{/gist_id}","starred_url":"https://api.github.com/users/mdawar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdawar/subscriptions","organizations_url":"https://api.github.com/users/mdawar/orgs","repos_url":"https://api.github.com/users/mdawar/repos","events_url":"https://api.github.com/users/mdawar/events{/privacy}","received_events_url":"https://api.github.com/users/mdawar/received_events","type":"User","site_admin":false},"created_at":"2016-11-02T10:30:40Z","updated_at":"2016-11-02T10:30:40Z","body":"@dstftw are there any other fixes required ?"}}
{"actor":{"display_login":"mdawar"}}