def connection_wrapper(&block)
        begin
          response = block.call
          raise ClientError.new(response.body['error']) if response.body.has_key?('error')
        rescue Faraday::ParsingError => e
          # Has gotten a response, but it is not formatted with JSON
          raise ClientError.new(e.message)
        rescue Faraday::ClientError => e
          # Failed to build a connection
          raise ConnectionError.new(e.message)
        end

        response
      end
def connection_wrapper(&block)
        begin
          response = block.call
          raise ClientError.new(response.body['error']) if response.body.has_key?('error')
        rescue Faraday::ParsingError => e
          # Has gotten a response, but it is not formatted with JSON
          raise ClientError.new(e.message)
        rescue Faraday::ClientError => e
          # Failed to build a connection
          raise ConnectionError.new(e.message)
        end

        response
      end
Connect with error handling
 @param [Proc] block