Module: ResourceFull::CoreExtensions::Exception

Included in:
Exception
Defined in:
lib/resource_full/core_extensions/exception.rb

Instance Method Summary collapse

Instance Method Details

#to_json(options = {}) ⇒ Object



15
16
17
18
# File 'lib/resource_full/core_extensions/exception.rb', line 15

def to_json(options = {})
  {"error" => {:text => self.to_s,
               :backtrace => self.backtrace}}.to_json
end

#to_xml(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/resource_full/core_extensions/exception.rb', line 4

def to_xml(options = {})
  options[:indent] ||= 2
  options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
  options[:builder].instruct! unless options[:skip_instruct]

  options[:builder].errors {
    options[:builder].error self.to_s
    options[:builder].error self.backtrace if options[:include_backtrace] == true
  }
end