 
 
 
-participantHandler = (funcName, data) ->
+participantHandler = (funcName, data, callback = ->) ->
 
   JSession          = require '../session'
   SocialChannel     = require './channel'
   { group, member } = data
 
   group.fetchAdmin (err, admin) ->
-    return console.error 'err while fetching admin', err  if err
-    return console.error 'couldnt find admin'  unless admin
+    if err
+      console.error 'err while fetching admin', err
+      return callback err
+
+    unless admin
+      console.error 'couldnt find admin'
+      return callback new Error 'couldnt find admin'
 
     sessionData = { username: admin.profile.nickname, groupName: group.slug }
     JSession.fetchSessionByData sessionData, (err, session) ->
-      return console.error 'err while fetching session', err  if err
-      return console.error 'couldnt find a session'  unless session
+      if err
+        console.error 'err while fetching session', err
+        return callback err
+
+      unless session
+        console.error 'couldnt find a session'
+        return callback new Error 'couldnt find a session'
 
       client = {}
       client.sessionToken = session.clientId

# dont want it to be listed first item while searching for account.coffe in
# sublime ~ CS

removeParticipantHandler = (data) ->
  participantHandler 'removeParticipants', data

addParticipantHandler = (data) ->
  participantHandler 'addParticipants', data

# SocialAccount
module.exports = class SocialAccount extends Base

          }

          SocialChannel[funcName] client, options, (err, participants) ->
            if err
              console.error "couldnt #{funcName} user into group socialapi chan", err, options
              return new Error "couldnt #{funcName} user into group socialapi chan"

            # only add koding's members to announcement channel
            return callback null if group.slug isnt 'koding'

            options = {
              channelId  : socialApiAnnouncementChannelId
