Exception: Exception

Defined in:
lib/merb-core/controller/exceptions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.action_nameObject

Returns the action_name that will be invoked on your Exceptions controller when an instance is raised during a request.

Returns

String

The name of the action in the Exceptions controller which will get invoked

when an instance of this Exception sub/class is raised by an action.

:api: public



33
34
35
36
37
38
39
40
41
# File 'lib/merb-core/controller/exceptions.rb', line 33

def self.action_name
  if self == Exception
    return nil unless Object.const_defined?(:Exceptions) && 
      Exceptions.method_defined?(:exception)
  end
  name = self.to_s.split('::').last.snake_case
  Object.const_defined?(:Exceptions) && 
    Exceptions.method_defined?(name) ? name : superclass.action_name
end

.statusObject

The status that will be sent in the response when an instance is raised during a request. Override this to send a different status.

Returns

Integer

The status code to send in the response. Defaults to 500.

:api: public



51
52
53
# File 'lib/merb-core/controller/exceptions.rb', line 51

def self.status
  500
end

Instance Method Details

#action_nameObject

Returns the action_name that will be invoked on your Exceptions controller when this exception is raised. Override this method to force a different action to be invoked.

Returns

String

The name of the action in the Exceptions controller which will get invoked

when this exception is raised during a request.

:api: public



11
# File 'lib/merb-core/controller/exceptions.rb', line 11

def action_name() self.class.action_name end

#same?(other) ⇒ Boolean

Returns

Boolean

Whether or not this exception is the same as another.

:api: public

Returns:

  • (Boolean)


18
19
20
21
22
# File 'lib/merb-core/controller/exceptions.rb', line 18

def same?(other)
  self.class == other.class &&
  self.message == other.message &&
  self.backtrace == other.backtrace
end