Sha256: 416f6c1680fda4635d863ba44a3ab071c841588f8e7568378cc6395242f91124

Contents?: true

Size: 1.19 KB

Versions: 15

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8
module Ayadn
  class Errors

    def self.global_error(args)
      if Logs.nil? || Logs.rec.nil?
        Status.new.wtf
        exit
      end
      thor = Thor::Shell::Color.new
      Logs.rec.error "--BEGIN--"
      Logs.rec.error "CAUSE: #{args[:error]}"
      Logs.rec.debug "DATA: #{args[:data]}"
      stack = args[:caller].map do |path|
        splitted = path.split('/')
        file = splitted.pop
        dir = splitted.pop
        "#{dir}/#{file}"
      end
      Logs.rec.debug "STACK: #{stack}"
      Logs.rec.error "--END--"
      thor.say_status :error, "logged in #{Settings.config[:paths][:log]}/ayadn.log", :red
      puts "\n"
      Debug.err(args[:error], stack)
      exit
    end

    def self.error(status)
      Logs.rec.error status
    end

    def self.warn(warning)
      Logs.rec.warn warning
    end

    def self.info(msg)
      Logs.rec.info msg
    end

    def self.repost(repost, original)
      Logs.rec.info "Post #{repost} is a repost. Using original: #{original}."
    end

    def self.nr msg
      Logs.nr.warn msg
    end

    def self.no_data(where)
      self.warn "In action/#{where}: no data"
      Status.new.empty_list
      exit
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ayadn-3.0 lib/ayadn/errors.rb
ayadn-2.1 lib/ayadn/errors.rb
ayadn-2.0.12 lib/ayadn/errors.rb
ayadn-2.0.11 lib/ayadn/errors.rb
ayadn-2.0.10 lib/ayadn/errors.rb
ayadn-2.0.9 lib/ayadn/errors.rb
ayadn-2.0.8 lib/ayadn/errors.rb
ayadn-2.0.7 lib/ayadn/errors.rb
ayadn-2.0.6 lib/ayadn/errors.rb
ayadn-2.0.5 lib/ayadn/errors.rb
ayadn-2.0.4 lib/ayadn/errors.rb
ayadn-2.0.3 lib/ayadn/errors.rb
ayadn-2.0.2 lib/ayadn/errors.rb
ayadn-2.0.1 lib/ayadn/errors.rb
ayadn-2.0 lib/ayadn/errors.rb