{"action":"created","issue":{"url":"https://api.github.com/repos/chaijs/chai/issues/596","labels_url":"https://api.github.com/repos/chaijs/chai/issues/596/labels{/name}","comments_url":"https://api.github.com/repos/chaijs/chai/issues/596/comments","events_url":"https://api.github.com/repos/chaijs/chai/issues/596/events","html_url":"https://github.com/chaijs/chai/issues/596","id":128400792,"number":596,"title":"Throw custom error (ES6)","user":{"login":"theofidry","id":5175937,"avatar_url":"https://avatars.githubusercontent.com/u/5175937?v=3","gravatar_id":"","url":"https://api.github.com/users/theofidry","html_url":"https://github.com/theofidry","followers_url":"https://api.github.com/users/theofidry/followers","following_url":"https://api.github.com/users/theofidry/following{/other_user}","gists_url":"https://api.github.com/users/theofidry/gists{/gist_id}","starred_url":"https://api.github.com/users/theofidry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theofidry/subscriptions","organizations_url":"https://api.github.com/users/theofidry/orgs","repos_url":"https://api.github.com/users/theofidry/repos","events_url":"https://api.github.com/users/theofidry/events{/privacy}","received_events_url":"https://api.github.com/users/theofidry/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chaijs/chai/labels/more-discussion-needed","name":"more-discussion-needed","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-24T14:35:30Z","updated_at":"2016-01-28T11:08:31Z","closed_at":null,"body":"Given a custom error:\r\n\r\n```js\r\nexport default class DummyError extends Error {\r\n    /**\r\n     * @param {string} [message='']\r\n     */\r\n    constructor(message = '') {\r\n        super(message);\r\n\r\n        this.name = 'DummyError';\r\n        this.message = message;\r\n\r\n        if (Error.hasOwnProperty('captureStackTrace')) {\r\n            Error.captureStackTrace(this, this.constructor);\r\n        }\r\n\r\n        this.stack = (new Error(message)).stack;\r\n    }\r\n}\r\n```\r\n\r\nAnd the following function:\r\n\r\n```js\r\nfunction throwDummyError() {\r\n    throw new DummyError();\r\n}\r\n```\r\n\r\nThe following doesn't work:\r\n\r\n```js\r\nassert.throw(throwDummyError, DummyError);\r\n```\r\n\r\nAnd instead is throwing:\r\n\r\n```\r\nAssertionError: expected [Function: DummyError] to throw 'DummyError' but 'my error message' was thrown\r\n```"},"comment":{"url":"https://api.github.com/repos/chaijs/chai/issues/comments/176125471","html_url":"https://github.com/chaijs/chai/issues/596#issuecomment-176125471","issue_url":"https://api.github.com/repos/chaijs/chai/issues/596","id":176125471,"user":{"login":"theofidry","id":5175937,"avatar_url":"https://avatars.githubusercontent.com/u/5175937?v=3","gravatar_id":"","url":"https://api.github.com/users/theofidry","html_url":"https://github.com/theofidry","followers_url":"https://api.github.com/users/theofidry/followers","following_url":"https://api.github.com/users/theofidry/following{/other_user}","gists_url":"https://api.github.com/users/theofidry/gists{/gist_id}","starred_url":"https://api.github.com/users/theofidry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/theofidry/subscriptions","organizations_url":"https://api.github.com/users/theofidry/orgs","repos_url":"https://api.github.com/users/theofidry/repos","events_url":"https://api.github.com/users/theofidry/events{/privacy}","received_events_url":"https://api.github.com/users/theofidry/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T11:08:31Z","updated_at":"2016-01-28T11:08:31Z","body":"Unfortunately no, busy times :disappointed:. But think I will be able to do it today or during the weekend..."}}