<commit_before>require 'helpers/application_helper'
require 'helpers/xbmc_config_helper'
require 'helpers/xbmc/xbmc_connect'

module ErrorHelper
  include ApplicationHelper
    
  def error_handle(params="")
    type = "unknown"
    if XbmcConfigHelper.current_config.nil?
      type = error_no_config
    elsif !params.blank?
      type = error_http(params)
    elsif !XbmcConnect.api_loaded?
      type = error_no_api
    end
    return type
  end
  
  private 
  def error_no_config
    Alert.show_popup ({
      :message => "Please create or activate an XBMC Config",
      :title => "No Active XBMC Config",
      :buttons => ["Close"]
    })
    "no config"
  end
  
  def error_http(params)
    type = "http unknown"
    if params['http_error'] == '401'
      XbmcConnect.error = {:error => XbmcConnect::ERROR401, :msg => "Couldn't connect. Username and Password incorrect"}
      type = "http 401"
    else
      XbmcConnect.error = {:error => XbmcConnect::ERRORURL, :msg => "Couldn't connect.  URL and/or Port incorrect"}
      type = "http 404"
    end
    Alert.show_popup ({
      :message => XbmcConnect.error[:msg],
      :title => XbmcConnect.error[:error],
      :buttons => ["Close"]
    })
    return type
  end
  
  def error_no_api
    XbmcConnect.error = {:error => XbmcConnect::ERRORAPI, :msg => "API hasn't been loaded. Ensure XBMC Config is correct"}
    Alert.show_popup ({
      :message => "There is no API loaded. Ensure XBMC Config is correct.",
      :title => XbmcConnect::ERRORAPI,
      :buttons => ["Close"]
    })
    
    "no api"
  end

end<commit_msg>No longer need Alert window for network issues.<commit_after>require 'helpers/application_helper'
require 'helpers/xbmc_config_helper'
require 'helpers/xbmc/xbmc_connect'

module ErrorHelper 
  include ApplicationHelper

  def error_handle(params="")
    type = "unknown"
    if XbmcConfigHelper.current_config.nil?
      type = error_no_config
    elsif !params.blank?
      type = error_http(params)
    elsif !XbmcConnect.api_loaded?
      type = error_no_api
    end
    return type
  end
  
  private 
  def error_no_config
    Alert.show_popup ({
      :message => "Please create or activate an XBMC Config",
      :title => "No Active XBMC Config",
      :buttons => ["Close"]
    })
    "no config"
  end
  
  def error_http(params)
    puts "ERROR HANDLE == #{params}"
    type = "http unknown"
    if params['http_error'] == '401'
      XbmcConnect.error = {:error => XbmcConnect::ERROR401, :msg => "Username and Password incorrect"}
      type = "http 401"
    else
      XbmcConnect.error = {:error => XbmcConnect::ERRORURL, :msg => "URL and/or Port incorrect"}
      type = "http 404"
    end
    #Alert.show_popup ({
    #  :message => XbmcConnect.error[:msg],
    #  :title => XbmcConnect.error[:error],
    #  :buttons => ["Close"]
    #})
    return type
  end
  
  def error_no_api
    XbmcConnect.error = {:error => XbmcConnect::ERRORAPI, :msg => "API hasn't been loaded. Ensure XBMC Config is correct"}
    Alert.show_popup ({
      :message => "There is no API loaded. Ensure XBMC Config is correct.",
      :title => XbmcConnect::ERRORAPI,
      :buttons => ["Close"]
    })
    "no api"
  end

  

end
{'fraction_non_alphanumeric': 0.11982570806100218, 'fraction_numerical': 0.007469654528478058, 'mean_word_length': 2.9339045287637697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '635098', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1049, 'n_words': 272}