Exception: SimpleGCM::Error::BaseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/simple_gcm/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ex, response = nil) ⇒ BaseError

Returns a new instance of BaseError.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simple_gcm/error.rb', line 5

def initialize(ex, response = nil)
  @wrapped_exception = nil
  @response = response

  if ex.respond_to?(:backtrace)
    super(ex.message)
    @wrapped_exception = ex
  elsif ex.respond_to?(:each_key)
    super("GCM server responded with error #{ex[:error]} and status #{ex[:status]}")
    @response = ex
  else
    super(ex.to_s)
  end
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



3
4
5
# File 'lib/simple_gcm/error.rb', line 3

def response
  @response
end

Instance Method Details

#backtraceObject



20
21
22
23
24
25
26
# File 'lib/simple_gcm/error.rb', line 20

def backtrace
  if @wrapped_exception
    @wrapped_exception.backtrace
  else
    super
  end
end

#inspectObject



28
29
30
# File 'lib/simple_gcm/error.rb', line 28

def inspect
  %(#<#{self.class}>)
end