{"comment":{"url":"https://api.github.com/repos/aquid/multi-tenancy-loopback/comments/17096104","html_url":"https://github.com/aquid/multi-tenancy-loopback/commit/68926163515cb84c2e07bd38e315875ba2db14b6#commitcomment-17096104","id":17096104,"user":{"login":"pulkitsinghal","id":821963,"avatar_url":"https://avatars.githubusercontent.com/u/821963?v=3","gravatar_id":"","url":"https://api.github.com/users/pulkitsinghal","html_url":"https://github.com/pulkitsinghal","followers_url":"https://api.github.com/users/pulkitsinghal/followers","following_url":"https://api.github.com/users/pulkitsinghal/following{/other_user}","gists_url":"https://api.github.com/users/pulkitsinghal/gists{/gist_id}","starred_url":"https://api.github.com/users/pulkitsinghal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulkitsinghal/subscriptions","organizations_url":"https://api.github.com/users/pulkitsinghal/orgs","repos_url":"https://api.github.com/users/pulkitsinghal/repos","events_url":"https://api.github.com/users/pulkitsinghal/events{/privacy}","received_events_url":"https://api.github.com/users/pulkitsinghal/received_events","type":"User","site_admin":false},"position":4,"line":39,"path":"common/models/org-user.js","commit_id":"68926163515cb84c2e07bd38e315875ba2db14b6","created_at":"2016-04-14T02:56:22Z","updated_at":"2016-04-14T02:56:22Z","body":"I feel that having both these statements is wrong:\r\n```\r\ncb(error);\r\nreturn Promise.reject(error);\r\n```\r\n\r\nWhat you probably want is this in the beginning of the function:\r\n```\r\nvar loopbackUtils = require('loopback/lib/utils');\r\n...\r\n      // handle both callbacks and promise based invocations\r\n      cb = cb || loopbackUtils.createPromiseCallback();\r\n```\r\n\r\nThen later `cb(error)` will behave properly depending on if its a real callback or a promise pretending to be a callback."}}