class Ayadn::Errors
Public Class Methods
error(status)
click to toggle source
# File lib/ayadn/errors.rb, line 28 def self.error(status) Logs.rec.error status end
global_error(args)
click to toggle source
# File lib/ayadn/errors.rb, line 5 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
info(msg)
click to toggle source
# File lib/ayadn/errors.rb, line 36 def self.info(msg) Logs.rec.info msg end
no_data(where)
click to toggle source
# File lib/ayadn/errors.rb, line 48 def self.no_data(where) self.warn "In action/#{where}: no data" Status.new.empty_list exit end
nr(msg)
click to toggle source
# File lib/ayadn/errors.rb, line 44 def self.nr msg Logs.nr.warn msg end
repost(repost, original)
click to toggle source
# File lib/ayadn/errors.rb, line 40 def self.repost(repost, original) Logs.rec.info "Post #{repost} is a repost. Using original: #{original}." end
warn(warning)
click to toggle source
# File lib/ayadn/errors.rb, line 32 def self.warn(warning) Logs.rec.warn warning end