{"action":"closed","issue":{"url":"https://api.github.com/repos/jasmine/jasmine/issues/819","labels_url":"https://api.github.com/repos/jasmine/jasmine/issues/819/labels{/name}","comments_url":"https://api.github.com/repos/jasmine/jasmine/issues/819/comments","events_url":"https://api.github.com/repos/jasmine/jasmine/issues/819/events","html_url":"https://github.com/jasmine/jasmine/issues/819","id":67111485,"number":819,"title":"toThrowError doesn't consider inheritance","user":{"login":"chge","id":400840,"avatar_url":"https://avatars.githubusercontent.com/u/400840?v=3","gravatar_id":"","url":"https://api.github.com/users/chge","html_url":"https://github.com/chge","followers_url":"https://api.github.com/users/chge/followers","following_url":"https://api.github.com/users/chge/following{/other_user}","gists_url":"https://api.github.com/users/chge/gists{/gist_id}","starred_url":"https://api.github.com/users/chge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chge/subscriptions","organizations_url":"https://api.github.com/users/chge/orgs","repos_url":"https://api.github.com/users/chge/repos","events_url":"https://api.github.com/users/chge/events{/privacy}","received_events_url":"https://api.github.com/users/chge/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-08T11:49:21Z","updated_at":"2015-04-09T22:38:31Z","closed_at":"2015-04-09T22:38:31Z","body":"`toThrowError` is very useful, but I think it works incorrectly with custom error classes.\r\n\r\n```javascript\r\nfunction PirateError(message) {\r\n\tthis.message = 'Arrggghhhh! ' + message;\r\n}\r\nPirateError.prototype = new Error();\r\n\r\ndescribe('custom try/catch', function() {\r\n\tit('works fine in tests', function() {\r\n\t\ttry {\r\n\t\t\tthrow new PirateError();\r\n\t\t} catch (error) {\r\n\t\t\texpect(error).toEqual(jasmine.any(Error));\r\n\t\t\texpect(error).toEqual(jasmine.any(PirateError));\r\n\t\t\texpect(error instanceof Error).toBeTruthy();\r\n\t\t\texpect(error instanceof PirateError).toBeTruthy();\r\n\t\t}\r\n\t});\r\n});\r\n\r\ndescribe('toThrowError', function() {\r\n\tit('considers error inheritance', function() {\r\n\t\texpect(function() {\r\n\t\t\tthrow new PirateError('Blow me down!');\r\n\t\t}).toThrowError(PirateError);\r\n\t});\r\n});\r\n```\r\n\r\nResult:\r\n```\r\nExpected function to throw PirateError, but it threw Error.\r\n```"}}