             if not validation.isValid
               error = validation.error
               message = 'Unknown action or bad record format from server'
-              setImmediate => @emit 'error', new PubSubError("#{message}: #{rec}", error)
+              setImmediate => @emit 'error', new errors.PubSubError("#{message}: #{rec}", error)
 
               logger.error "#{message}: #{error}\n#{error.stack}"
             else

        .catch (error) ->
          message = "Socket error while unsubscribing from channel:"
          logger.error message, error
          reject new error.PubSubError message, error 
        
      else
        message = "Could not unsubscribe from channel as the socket is currently disconnected."
        logger.warn message
        reject new error.PubSubError message, null

    .then (response) -> response.channels


        .catch (error) ->
          message = "Socket error listing connection subscriptions:"
          logger.error message, error
          reject new errors.PubSubError message, error 
        
      else
        message = "Could not list channel subscriptions as the socket is currently disconnected."
        logger.warn message
        reject new errors.PubSubError message, null

    .then (response) -> response.channels

