class LeadRouter::Exception
All possible exceptions raised by the LeadRouter::Client
will be an instance of this class
Use 'original_exception' method to access the original exception object , or just 'to_s' to display a nice error message
If the error was an invalid HTTP status code, 'http_code' and 'http_body' methods will be available (they return 0 and “” otherwise)
Attributes
original_exception[RW]
Public Class Methods
new(exception)
click to toggle source
# File lib/lead_router/exceptions.rb, line 15 def initialize(exception) @original_exception = exception end
Public Instance Methods
http_body()
click to toggle source
# File lib/lead_router/exceptions.rb, line 28 def http_body original_exception.respond_to?(:http_body) ? original_exception.http_body : "" end
http_code()
click to toggle source
# File lib/lead_router/exceptions.rb, line 24 def http_code original_exception.respond_to?(:http_code) ? original_exception.http_code : 0 end
to_s()
click to toggle source
# File lib/lead_router/exceptions.rb, line 19 def to_s return "#{original_exception.to_s}: HTTP status #{http_code} with body #{http_body}" unless http_code == 0 original_exception.to_s end