Module: Toq::Exceptions

Defined in:
lib/toq/exceptions.rb

Defined Under Namespace

Classes: Base, ConnectionError, InvalidMethod, InvalidObject, InvalidToken, RemoteException, SSLPeerVerificationFailed, UnsafeMethod

Class Method Summary collapse

Class Method Details

.from_response(response) ⇒ Exception

Returns an exception based on the response object.

Parameters:

Returns:

  • (Exception)


69
70
71
72
73
74
75
# File 'lib/toq/exceptions.rb', line 69

def self.from_response( response )
    exception = response.exception
    klass = Toq::Exceptions.const_get( exception['type'].to_sym )
    e = klass.new( exception['message'] )
    e.set_backtrace( exception['backtrace'] )
    e
end