Class Exception
In: lib/core/facets/exception/detail.rb
lib/core/facets/exception/suppress.rb
Parent: Object

Methods

detail   suppress  

Public Class methods

Supress errors while executing a block, with execptions.

 CREDIT: Trans
 CREDIT: David Heinemeier Hansson

[Source]

# File lib/core/facets/exception/suppress.rb, line 8
  def self.suppress(*exception_classes)
    exception_classes.each do |e|
      unless e < self
        raise ArgumentError, "exception #{e} not a subclass of #{self}"
      end
    end
    begin yield
    rescue Exception => e
      raise unless exception_classes.any? { |cls| e.kind_of?(cls) }
    end
  end

Public Instance methods

Pretty string output of exception/error object useful for helpful debug messages.

Input: The Exception/StandardError object

Output: The pretty printed string

 CREDIT: George Moschovitis

[Source]

# File lib/core/facets/exception/detail.rb, line 14
  def detail
    return %{#{message}\n  #{backtrace.join("\n  ")}\n  LOGGED FROM: #{caller[0]}}
  end

[Validate]