 
     .then (response) -> response.channels
 
+    .catch (error) =>
+      logger.error "Error subscribing to channel '#{channel}'", error
+      delete @handlers[channel]
+
   # Unsubscribe from a channel.
   unsubscribe: (channel) ->
+    delete @handlers[channel]
+
     new P (resolve, reject) =>
       if @sock?
         seq = @sequence

                    response.message, null, record.code,
                    record.details, record
                  ))
              else if message.id?
                @emit 'message', record
              else
                message = 'Valid, but un-handled response type.'
                logger.error "#{message}"
                @emit 'error', new PubSubError("#{message}: #{rec}")

          # WebSoket connection failure
          @sock.once 'connectFailed', (error) =>
            @emit 'connectFailed', error
            logger.error "Failed to connect to Pub/Sub WebSocket"

        reject new error.PubSubError message, null

  # Subscribe to a channel.
  subscribe: (channel, handler) ->
    if typeof handler == 'function'
      @handlers[channel] = handler

    new P (resolve, reject) =>
      if @sock?
        seq = @sequence
