Exception: QRPC::Client::Exception
- Inherits:
-
Exception
- Object
- Exception
- QRPC::Client::Exception
- Defined in:
- lib/qrpc/client/exception.rb
Overview
Queue RPC client exception.
Class Method Summary collapse
-
.get(proto) ⇒ Exception, QRPC::Client::Exception
Gets one from protocol exception object.
Instance Method Summary collapse
-
#initialize(data) ⇒ Exception
constructor
Constructor.
Constructor Details
#initialize(data) ⇒ Exception
Constructor. Initializes from protocol exception data object.
66 67 68 69 70 71 72 73 |
# File 'lib/qrpc/client/exception.rb', line 66 def initialize(data) = data.name.dup << ": " << data. backtrace = data.backtrace.map { |i| Base64.decode64(i) } backtrace.reject! { |i| i.empty? } super() self.set_backtrace(backtrace) end |
Class Method Details
.get(proto) ⇒ Exception, QRPC::Client::Exception
Gets one from protocol exception object. Returns marshalled original or reconstructed version.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/qrpc/client/exception.rb', line 37 def self.get(proto) # Converts protocol exception to exception data object proto = QRPC::Protocol::ExceptionData::new(proto.data) # Tries to unmarshall if proto.dump.format == :ruby begin exception = Marshal.load(Base64.decode64(proto.dump.raw)) rescue # pass end end # If unsuccessfull, creates from data if exception.nil? exception = self::new(proto) end return exception end |