Class: Ayadn::Errors

Inherits:
Object
  • Object
show all
Defined in:
lib/ayadn/errors.rb

Class Method Summary collapse

Class Method Details

.error(status) ⇒ Object



17
18
19
# File 'lib/ayadn/errors.rb', line 17

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

.global_error(where, args, error) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ayadn/errors.rb', line 4

def self.global_error(where, args, error)
  #elems = []
  #args.each {|arg| elems << self.detokenize(arg)} #TODO: make it work
  Logs.rec.error "--BEGIN--"
  Logs.rec.error "#{error}"
  Logs.rec.debug "LOCATION: #{where}"
  Logs.rec.debug "DATA: #{args}"
  Logs.rec.debug "STACK: #{caller}"
  Logs.rec.error "--END--"
  puts "\n(error logged in #{Settings.config[:paths][:log]}/ayadn.log)\n".color(:blue)
  Debug.err error
  exit
end

.info(msg) ⇒ Object



23
24
25
# File 'lib/ayadn/errors.rb', line 23

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

.nr(msg) ⇒ Object



29
30
31
# File 'lib/ayadn/errors.rb', line 29

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

.repost(repost, original) ⇒ Object



26
27
28
# File 'lib/ayadn/errors.rb', line 26

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

.warn(warning) ⇒ Object



20
21
22
# File 'lib/ayadn/errors.rb', line 20

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