Exception: Marley::MarleyError

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

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMarleyError

Returns a new instance of MarleyError.



7
8
9
# File 'lib/marley/errors.rb', line 7

def initialize
  self.class.details=self.backtrace
end

Class Attribute Details

.descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/marley/errors.rb', line 4

def description
  @description
end

.detailsObject

Returns the value of attribute details.



4
5
6
# File 'lib/marley/errors.rb', line 4

def details
  @details
end

.headersObject

Returns the value of attribute headers.



4
5
6
# File 'lib/marley/errors.rb', line 4

def headers
  @headers
end

.resp_codeObject

Returns the value of attribute resp_code.



4
5
6
# File 'lib/marley/errors.rb', line 4

def resp_code
  @resp_code
end

Instance Method Details

#log_errorObject



10
11
12
# File 'lib/marley/errors.rb', line 10

def log_error
  $log.fatal("#$!.message}\n#{$!.backtrace}")
end

#to_aObject



13
14
15
16
17
18
# File 'lib/marley/errors.rb', line 13

def to_a
  log_error
  json=[:error,{:error_type => self.class.name.underscore.sub(/_error$/,'').sub(/^marley\//,''),:description => self.class.description, :error_details => self.class.details}].to_json
  self.class.headers||={'Content-Type' => "#{$request[:content_type]}; charset=utf-8"}
  [self.class.resp_code,self.class.headers,json]
end