Class: Ayadn::Errors
- Inherits:
-
Object
- Object
- Ayadn::Errors
- Defined in:
- lib/ayadn/errors.rb
Class Method Summary collapse
- .error(status) ⇒ Object
- .global_error(args) ⇒ Object
- .info(msg) ⇒ Object
- .no_data(where) ⇒ Object
- .nr(msg) ⇒ Object
- .repost(repost, original) ⇒ Object
- .warn(warning) ⇒ Object
- .whine(status, resp) ⇒ Object
Class Method Details
.error(status) ⇒ Object
24 25 26 |
# File 'lib/ayadn/errors.rb', line 24 def self.error(status) Logs.rec.error status end |
.global_error(args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ayadn/errors.rb', line 5 def self.global_error(args) abort(Status.wtf) if Logs.nil? || Logs.rec.nil? 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.debug "STACK: #{args[:caller]}" Logs.rec.error "--END--" puts "\nError logged in #{Settings.config[:paths][:log]}/ayadn.log\n".color(:blue) Debug.err(args[:error], stack) exit end |
.info(msg) ⇒ Object
32 33 34 |
# File 'lib/ayadn/errors.rb', line 32 def self.info(msg) Logs.rec.info msg end |
.no_data(where) ⇒ Object
49 50 51 52 |
# File 'lib/ayadn/errors.rb', line 49 def self.no_data(where) self.warn "In action/#{where}: no data" abort(Status.empty_list) end |
.nr(msg) ⇒ Object
40 41 42 |
# File 'lib/ayadn/errors.rb', line 40 def self.nr msg Logs.nr.warn msg end |
.repost(repost, original) ⇒ Object
36 37 38 |
# File 'lib/ayadn/errors.rb', line 36 def self.repost(repost, original) Logs.rec.info "Post #{repost} is a repost. Using original: #{original}." end |
.warn(warning) ⇒ Object
28 29 30 |
# File 'lib/ayadn/errors.rb', line 28 def self.warn(warning) Logs.rec.warn warning end |
.whine(status, resp) ⇒ Object
44 45 46 47 |
# File 'lib/ayadn/errors.rb', line 44 def self.whine(status, resp) puts status self.error("#{status} => #{resp['meta']}") end |