         .catch (error) ->
           message = "Socket error while subscribing to channel:"
           logger.error message, error
-          reject new error.PubSubError message, error 
+          reject new errors.PubSubError message, error 
         
       else
         message = "Could not subscribe to channel as the socket is currently disconnected."
         logger.warn message
-        reject new error.PubSubError message, null
+        reject new errors.PubSubError message, null
 
     .then (response) -> response.channels
 

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

  # Subscribe to a channel.
  subscribe: (channel, handler) ->

                    timestamp: time
                    id: id
              else
                setImmediate => @emit 'error', new errors.PubSubError("#{message}: #{rec}")

                message = 'Valid, but un-handled response type.'
                logger.error "#{message}"
