       if @visualization == "data"
         @replyContext.looker.client.get("queries/#{query.id}/run/unified", (result) =>
           @postResult(query, result)
-        => @replyError())
+        (r) => @replyError(r))
       else
         @replyContext.looker.client.get("queries/#{query.id}/run/png", (result) =>
           @postImage(query, result)
-        => @replyError()
+        (r) => @replyError(r)
         {encoding: null})
-    , => @replyError())
+    , (r) => @replyError(r))

      if !look.public
        @runQuery(look.query, message.attachments[0])

    => @replyError())

module.exports.CLIQueryRunner = class CLIQueryRunner extends QueryRunner


    else if response?.message
      @reply(":warning: #{response.message}")
    else
      @reply(":warning: Something unexpected went wrong: #{JSON.stringify(response)}")

  work: ->
    @replyContext.looker.client.get("queries/slug/#{@querySlug}", (query) =>
      @runQuery(query)
    (r) => @replyError(r))

  runQuery: (query, options = {}) ->
    type = query.vis_config?.type || "table"
    if type == "table"
      @replyContext.looker.client.get("queries/#{query.id}/run/unified", (result) =>
        @postResult(query, result, options)
      (r) => @replyError(r))
    else
      @replyContext.looker.client.get("queries/#{query.id}/run/png", (result) =>
        @postImage(query, result, options)
      (r) => @replyError(r)
      {encoding: null})

module.exports.LookQueryRunner = class CLIQueryRunner extends QueryRunner
