Class: FaultObject

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyamf/fault.rb

Overview

Convenience object carried over from rubyamf_plugin, it can be returned for AMF instead of raising an exception.

Example:

render :amf => FaultObject.new("No users to get")

Class Method Summary collapse

Class Method Details

.new(*args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubyamf/fault.rb', line 13

def self.new *args, &block
  if args.length == 2
    raise "payload for FaultObject is no longer available - if you need it you will need to create a custom class to contain your payload"
  end
  message = args.length > 0 ? args[0] : ''

  begin
    raise RubyAMF::Fault.new(message) 
  rescue Exception => e
    # Fix backtrace
    b = e.backtrace
    b.shift
    e.set_backtrace(b)

    # Return new fault object
    return e
  end
end