{"action":"closed","issue":{"url":"https://api.github.com/repos/origamitower/folktale/issues/153","repository_url":"https://api.github.com/repos/origamitower/folktale","labels_url":"https://api.github.com/repos/origamitower/folktale/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/origamitower/folktale/issues/153/comments","events_url":"https://api.github.com/repos/origamitower/folktale/issues/153/events","html_url":"https://github.com/origamitower/folktale/issues/153","id":252950812,"number":153,"title":"Race condition errors in Task have unhelpful error messages","user":{"login":"robotlolita","id":406477,"avatar_url":"https://avatars1.githubusercontent.com/u/406477?v=4","gravatar_id":"","url":"https://api.github.com/users/robotlolita","html_url":"https://github.com/robotlolita","followers_url":"https://api.github.com/users/robotlolita/followers","following_url":"https://api.github.com/users/robotlolita/following{/other_user}","gists_url":"https://api.github.com/users/robotlolita/gists{/gist_id}","starred_url":"https://api.github.com/users/robotlolita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robotlolita/subscriptions","organizations_url":"https://api.github.com/users/robotlolita/orgs","repos_url":"https://api.github.com/users/robotlolita/repos","events_url":"https://api.github.com/users/robotlolita/events{/privacy}","received_events_url":"https://api.github.com/users/robotlolita/received_events","type":"User","site_admin":false},"labels":[{"id":623850960,"url":"https://api.github.com/repos/origamitower/folktale/labels/a:Base","name":"a:Base","color":"fef2c0","default":false},{"id":438532242,"url":"https://api.github.com/repos/origamitower/folktale/labels/c:Concurrency","name":"c:Concurrency","color":"bfd4f2","default":false},{"id":390893176,"url":"https://api.github.com/repos/origamitower/folktale/labels/e:Unknown","name":"e:Unknown","color":"bfe5bf","default":false},{"id":210364054,"url":"https://api.github.com/repos/origamitower/folktale/labels/k:Error","name":"k:Error","color":"fc2929","default":false},{"id":390893468,"url":"https://api.github.com/repos/origamitower/folktale/labels/p:Wishlist","name":"p:Wishlist","color":"fad8c7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-08-25T16:16:17Z","updated_at":"2018-02-18T21:54:19Z","closed_at":"2018-02-18T21:54:19Z","author_association":"OWNER","body":"The error messages for race errors in Task is unhelpful:\r\n\r\n```text\r\n_deferred.js:49 Uncaught Error: Only pending deferreds can be resolved, this deferred is already resolved.\r\n```\r\n\r\n### Steps to reproduce\r\n\r\nThis happens after trying to settle a Task's deferred that has already settled. It errors because this is most likely an error in the Task's code.\r\n\r\n```js\r\nconst { task } = require('folktale/concurrency/task');\r\nconst ohno = task(resolver => {\r\n  resolver.resolve(1);\r\n  resolver.resolve(2); // <- an error\r\n});\r\n\r\nohno.run();\r\n// => Uncaught Error: Only pending deferreds can be resolved, this deferred is already resolved.\r\n```\r\n\r\n### Additional information\r\n\r\nWhile this is how it should work (ignoring those errors may lead to even more confusing problems elsewhere!), the error message is not very helpful. To begin with, the stack trace is from an internal Deferred type, and it's hard to see what it's related to.\r\n\r\nThe error message should try to include where people should be looking for the error. We could also consider providing safe versions of resolve/reject so people can be intentional about how they expect that call to go, something like `resolveIfNotSettled`."}}
{"actor":{"display_login":"robotlolita"}}