Class: XExceptionResponse

Inherits:
XResponse show all
Defined in:
lib/rails-extjs-direct/xexception.rb

Overview

XExceptionResponse A special extension of XResponse for returning responses where an Exception was raised. includes a back-trace in the response which should probably be turned on with a debug switch only.

Author:

  • Chris Scott

Instance Attribute Summary collapse

Attributes inherited from XResponse

#errors, #message, #result, #status, #success, #tid, #type

Instance Method Summary collapse

Methods inherited from XResponse

#to_json

Constructor Details

#initialize(req, e) ⇒ XExceptionResponse

initialize

Parameters:



23
24
25
26
27
28
# File 'lib/rails-extjs-direct/xexception.rb', line 23

def initialize(req, e)
    super(req)
    @type       = 'exception'
    @message    = e.message
    @where      = e.backtrace
end

Instance Attribute Details

#whereObject

Returns the value of attribute where.



16
17
18
# File 'lib/rails-extjs-direct/xexception.rb', line 16

def where
  @where
end

Instance Method Details

#to_hObject



30
31
32
33
34
35
# File 'lib/rails-extjs-direct/xexception.rb', line 30

def to_h
    data = super
    data[:type]     = 'exception'
    data[:where]    = @where.join("\n")
    data
end