def handle_error(err, data = nil)
      case determine_error_type(err)
      when :token_revoked
        on_revoke(data)
      when :rate_limited
        on_rate_limit(data)
      when :closed
        on_close(data)
      else
        on_error(err, data)
      end
    end
def handle_error(err, data = nil)
      case determine_error_type(err)
      when :token_revoked
        on_revoke(data)
      when :rate_limited
        on_rate_limit(data)
      when :closed
        on_close(data)
      else
        on_error(err, data)
      end
    end
Handle different error cases