{"action":"created","issue":{"url":"https://api.github.com/repos/balderdashy/waterline-docs/issues/95","labels_url":"https://api.github.com/repos/balderdashy/waterline-docs/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/balderdashy/waterline-docs/issues/95/comments","events_url":"https://api.github.com/repos/balderdashy/waterline-docs/issues/95/events","html_url":"https://github.com/balderdashy/waterline-docs/pull/95","id":107260340,"number":95,"title":"Removed the promisey pyramid of doom","user":{"login":"BLamy","id":324928,"avatar_url":"https://avatars.githubusercontent.com/u/324928?v=3","gravatar_id":"","url":"https://api.github.com/users/BLamy","html_url":"https://github.com/BLamy","followers_url":"https://api.github.com/users/BLamy/followers","following_url":"https://api.github.com/users/BLamy/following{/other_user}","gists_url":"https://api.github.com/users/BLamy/gists{/gist_id}","starred_url":"https://api.github.com/users/BLamy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BLamy/subscriptions","organizations_url":"https://api.github.com/users/BLamy/orgs","repos_url":"https://api.github.com/users/BLamy/repos","events_url":"https://api.github.com/users/BLamy/events{/privacy}","received_events_url":"https://api.github.com/users/BLamy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-18T19:11:50Z","updated_at":"2015-09-23T01:43:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/balderdashy/waterline-docs/pulls/95","html_url":"https://github.com/balderdashy/waterline-docs/pull/95","diff_url":"https://github.com/balderdashy/waterline-docs/pull/95.diff","patch_url":"https://github.com/balderdashy/waterline-docs/pull/95.patch"},"body":"There seems to be a few things wrong with this code snippet. \r\n\r\n1) The catch block should be on the outside promise. If `User.create` fails you will have no idea.\r\n2) When passing `console.log` or `console.error` into `then` or `catch` you should bind this to console\r\n\r\n3) Is it really necessary to save the relationship going backwards as well? Granted I'm not a waterline expert but I don't remember having to do this when working with sails.\r\n\r\nI understand that you guys nested the promise because you needed to capture `user`. But if you don't need to save it back it would probably be best not having an example with a nested promise. Lots of people don't fully understand promises and seeing nested promises as examples will just lead to them creating promise callback hell. "},"comment":{"url":"https://api.github.com/repos/balderdashy/waterline-docs/issues/comments/142469804","html_url":"https://github.com/balderdashy/waterline-docs/pull/95#issuecomment-142469804","issue_url":"https://api.github.com/repos/balderdashy/waterline-docs/issues/95","id":142469804,"user":{"login":"devinivy","id":3150233,"avatar_url":"https://avatars.githubusercontent.com/u/3150233?v=3","gravatar_id":"","url":"https://api.github.com/users/devinivy","html_url":"https://github.com/devinivy","followers_url":"https://api.github.com/users/devinivy/followers","following_url":"https://api.github.com/users/devinivy/following{/other_user}","gists_url":"https://api.github.com/users/devinivy/gists{/gist_id}","starred_url":"https://api.github.com/users/devinivy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devinivy/subscriptions","organizations_url":"https://api.github.com/users/devinivy/orgs","repos_url":"https://api.github.com/users/devinivy/repos","events_url":"https://api.github.com/users/devinivy/events{/privacy}","received_events_url":"https://api.github.com/users/devinivy/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T01:43:45Z","updated_at":"2015-09-23T01:43:45Z","body":"Thanks!"}}