Exception: Gat::GagetExceptions

Inherits:
StandardError
  • Object
show all
Defined in:
lib/gat/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, location, options = {}) ⇒ GagetExceptions

Returns a new instance of GagetExceptions.



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gat/exceptions.rb', line 32

def initialize(error, location, options = {})
  if error.is_a?(Exception)
    super(options[:message].nil? ? error.message : options[:message] )
    @exception_backtrace = error.backtrace
  else
    super(error)
    @exception_backtrace = nil
  end
  @exception_location = location
  @exception_options = options
end

Instance Attribute Details

#exception_backtraceObject (readonly)

Returns the value of attribute exception_backtrace.



30
31
32
# File 'lib/gat/exceptions.rb', line 30

def exception_backtrace
  @exception_backtrace
end

#exception_locationObject (readonly)

Returns the value of attribute exception_location.



28
29
30
# File 'lib/gat/exceptions.rb', line 28

def exception_location
  @exception_location
end

#exception_optionsObject (readonly)

Returns the value of attribute exception_options.



29
30
31
# File 'lib/gat/exceptions.rb', line 29

def exception_options
  @exception_options
end

Instance Method Details

#exception_messageObject



44
45
46
# File 'lib/gat/exceptions.rb', line 44

def exception_message
  return message
end

#exit_errorObject



52
53
54
55
56
57
58
59
60
# File 'lib/gat/exceptions.rb', line 52

def exit_error
  error_string = "ERROR: `#{ self.exception_message }` at `#{ self.exception_location }`"
  if self.exception_backtrace
    error_string << "\nBACK:\n        #{ self.exception_backtrace.shift } \n        #{  self.exception_backtrace.join("\n        ") }"
  elsif self.backtrace
  	error_string << "\nBACK:\n        #{ self.backtrace.shift } \n        #{  self.backtrace.join("\n        ") }"
  end
  error_string
end

#exit_levelObject

:nodoc:



48
49
50
# File 'lib/gat/exceptions.rb', line 48

def exit_level #:nodoc: 
  return 0
end