Exception: Postini::RemoteException
- Defined in:
- lib/postini/exceptions.rb
Overview
Handle exceptions thrown by Postini
Direct Known Subclasses
AdminBlockException, AuthenticationException, BatchException, InternalException, InvalidValueException, MalformedKeyException, MissingElementException, NoSuchKeyException, StatusException, UnknownInternalException
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.delegate(reason) ⇒ Object
Find the correct sub-class and pass the exception on.
Instance Method Summary collapse
-
#initialize(reason) ⇒ RemoteException
constructor
A new instance of RemoteException.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(reason) ⇒ RemoteException
Returns a new instance of RemoteException.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/postini/exceptions.rb', line 35 def initialize( reason ) if reason =~ /^(\w+):(.*)\(Request ID ([0-9A-F\-]{36})\)$/ @type = $1 = $2.strip @request_id = $3 else = reason end end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
16 17 18 |
# File 'lib/postini/exceptions.rb', line 16 def end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
16 17 18 |
# File 'lib/postini/exceptions.rb', line 16 def request_id @request_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
16 17 18 |
# File 'lib/postini/exceptions.rb', line 16 def type @type end |
Class Method Details
.delegate(reason) ⇒ Object
Find the correct sub-class and pass the exception on
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/postini/exceptions.rb', line 21 def delegate( reason ) if reason =~ /^(\w+):/ type = $1 type << 'Exception' unless type =~ /Exception$/ if Postini.const_defined?( type ) return Postini.const_get( type ).new( reason ) end end return new( reason ) end |
Instance Method Details
#inspect ⇒ Object
46 47 48 |
# File 'lib/postini/exceptions.rb', line 46 def inspect "#{self.class} Type: #{@type}, Message: #{@message}, Request ID: #{@request_id}" end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/postini/exceptions.rb', line 50 def to_s inspect end |