Exception: Marley::MarleyError
- Defined in:
- lib/marley/errors.rb
Direct Known Subclasses
AuthenticationError, AuthorizationError, RoutingError, ValidationError
Class Attribute Summary collapse
-
.description ⇒ Object
Returns the value of attribute description.
-
.details ⇒ Object
Returns the value of attribute details.
-
.headers ⇒ Object
Returns the value of attribute headers.
-
.resp_code ⇒ Object
Returns the value of attribute resp_code.
Instance Method Summary collapse
-
#initialize ⇒ MarleyError
constructor
A new instance of MarleyError.
- #log_error ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ MarleyError
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
.description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/marley/errors.rb', line 4 def description @description end |
.details ⇒ Object
Returns the value of attribute details.
4 5 6 |
# File 'lib/marley/errors.rb', line 4 def details @details end |
.headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/marley/errors.rb', line 4 def headers @headers end |
.resp_code ⇒ Object
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_error ⇒ Object
10 11 12 |
# File 'lib/marley/errors.rb', line 10 def log_error $log.fatal("#$!.message}\n#{$!.backtrace}") end |
#to_a ⇒ Object
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 |