{"action":"created","issue":{"url":"https://api.github.com/repos/senecajs/seneca/issues/505","repository_url":"https://api.github.com/repos/senecajs/seneca","labels_url":"https://api.github.com/repos/senecajs/seneca/issues/505/labels{/name}","comments_url":"https://api.github.com/repos/senecajs/seneca/issues/505/comments","events_url":"https://api.github.com/repos/senecajs/seneca/issues/505/events","html_url":"https://github.com/senecajs/seneca/issues/505","id":172704575,"number":505,"title":"Pattern override and priors not working properly with arrow functions","user":{"login":"edwinallenz","id":205552,"avatar_url":"https://avatars.githubusercontent.com/u/205552?v=3","gravatar_id":"","url":"https://api.github.com/users/edwinallenz","html_url":"https://github.com/edwinallenz","followers_url":"https://api.github.com/users/edwinallenz/followers","following_url":"https://api.github.com/users/edwinallenz/following{/other_user}","gists_url":"https://api.github.com/users/edwinallenz/gists{/gist_id}","starred_url":"https://api.github.com/users/edwinallenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edwinallenz/subscriptions","organizations_url":"https://api.github.com/users/edwinallenz/orgs","repos_url":"https://api.github.com/users/edwinallenz/repos","events_url":"https://api.github.com/users/edwinallenz/events{/privacy}","received_events_url":"https://api.github.com/users/edwinallenz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/senecajs/seneca/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-23T13:50:44Z","updated_at":"2016-08-25T09:37:04Z","closed_at":"2016-08-25T09:37:04Z","body":"Doing the seneca in practice workshop I've notice that if an override is executing doing arrow function the prior action is not executed.\r\n\r\n### Fails with arrow function\r\n```javascript\r\n'use strict'\r\n\r\nmodule.exports = function math  (options) {\r\n\r\n    this.add({role:'math', cmd:'sum'}, (msg, callback) => {\r\n\r\n        var sum = parseFloat(msg.right) + parseFloat(msg.left)\r\n\r\n        callback(null, {answer:sum})\r\n    })\r\n\r\n    this.add({role:'math', cmd:'sum'}, (msg, callback) => {\r\n        if(!isFinite(msg.right) || !isFinite(msg.left))\r\n            return callback(new Error('Expected left and right to be numbers.'))\r\n\r\n\r\n        this.prior({role:'math',cmd:'sum', left:msg.left, right:msg.right}, (err, result) =>{\r\n\r\n            result.info = msg.left + '+' + msg.right\r\n            callback(null, result)\r\n        })\r\n\r\n    })\r\n}\r\n```\r\n\r\n### And it works if the arrow function is remove\r\n```javascript\r\n'use strict'\r\n\r\nmodule.exports = function math  (options) {\r\n\r\n    this.add({role:'math', cmd:'sum'}, (msg, callback) => {\r\n\r\n        var sum = parseFloat(msg.right) + parseFloat(msg.left)\r\n\r\n        callback(null, {answer:sum})\r\n    })\r\n\r\n    this.add({role:'math', cmd:'sum'}, function(msg, callback)  {\r\n        if(!isFinite(msg.right) || !isFinite(msg.left))\r\n            return callback(new Error('Expected left and right to be numbers.'))\r\n\r\n\r\n        this.prior({role:'math',cmd:'sum', left:msg.left, right:msg.right}, (err, result) =>{\r\n\r\n            result.info = msg.left + '+' + msg.right\r\n            callback(null, result)\r\n        })\r\n\r\n    })\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/senecajs/seneca/issues/comments/242331281","html_url":"https://github.com/senecajs/seneca/issues/505#issuecomment-242331281","issue_url":"https://api.github.com/repos/senecajs/seneca/issues/505","id":242331281,"user":{"login":"mcdonnelldean","id":3625961,"avatar_url":"https://avatars.githubusercontent.com/u/3625961?v=3","gravatar_id":"","url":"https://api.github.com/users/mcdonnelldean","html_url":"https://github.com/mcdonnelldean","followers_url":"https://api.github.com/users/mcdonnelldean/followers","following_url":"https://api.github.com/users/mcdonnelldean/following{/other_user}","gists_url":"https://api.github.com/users/mcdonnelldean/gists{/gist_id}","starred_url":"https://api.github.com/users/mcdonnelldean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcdonnelldean/subscriptions","organizations_url":"https://api.github.com/users/mcdonnelldean/orgs","repos_url":"https://api.github.com/users/mcdonnelldean/repos","events_url":"https://api.github.com/users/mcdonnelldean/events{/privacy}","received_events_url":"https://api.github.com/users/mcdonnelldean/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T09:37:04Z","updated_at":"2016-08-25T09:37:04Z","body":"NP, Any more questions please let us know 💃 "}}
{"actor":{"display_login":"mcdonnelldean"}}